Author: martin fierz
Date: 12:39:22 12/05/01
Go up one level in this thread
On December 05, 2001 at 03:20:36, David Rasmussen wrote: >On December 04, 2001 at 20:11:34, martin fierz wrote: > >>On December 04, 2001 at 09:16:22, Severi Salminen wrote: >> >>>Hi! >>> >>>What is the definition of "hamming distance"? What characteristics should I test >>>when testing my random numbers' suitability for zobrist keys? What alternatives >>>there are for random number generators besides the rand() in C? >>> >>>Severi >> >>aloha! >> >>my experience is from a checkers program, but it shouldnt really matter. >>i am using 32-bit random numbers generated by calling rand() twice, because >>rand() only returns a 16-bit value on my compiler. i used to use these numbers >>and read some posts here about hamming distance, so i decided to check: i >>produced myself a set of random numbers x_i with the condition >>hammingdistance(x_i,x_j) >=10 instead of the numbers the random generator was >>generating. in my test suite i run a depth 19 search on 80 positions and can >>compare two different versions - result: no difference. while i did have small >>changes like 101% or 99% in some test positions, it was never much and on >>average just zero. i don't know if my condition above is stupid or if it doesnt >>really matter. i think the condition is stupid, because you will only have a >>real problem if x_i XOR x_j equals some other x_k. or if x_i XOR x_j XOR x_k >>equals x_l XOR x_m etc. >>looks like these conditions are kind of hard to check... i also think it doesnt > >It is not hard to check, it just takes a "long" time. > >>matter: another thing i did was to initialize rand() with different seeds and >>see what happens. result: again zero. i'd like to see someone come up with hard >>numbers showing that rand() is really bad for generating zobrist keys. i don't >>believe it is. >> >>cheers >> martin > >The primary reason why rand() is bad, is that it isn't portable, in that it is >implementation defined. So when you move your program to another platform, you >can't use the same numbers, i.e. for an opening book etc. Also, RAND_MAX can be >all sorts of weird values, and finally no quality properties are guaranteed >about rand(). All this, and the simplicity of making (copying) your own PRNG, >makes me say that you should. > >/David you are right of course about the nonportable part, and i also use the random numbers for my opening book. so what i did was to just hard-code the random numbers given by rand() in my program, so that now i do not depend on rand() any more. of course i only did this after checking if the rand() numbers were bad... cheers martin
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.