Author: David Rasmussen
Date: 06:40:53 12/04/01
Go up one level in this thread
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 Hamming distance between two n-bit strings is defined to be the number of bit positions that differ in value. So if x = 100101011101101001 y = 001011011001011110 the hamming distance between x and y is 10 (if I have counted correctly). An easy way of calculating this is to count the number of 1's in (x xor y). It is not exactly clear what simple properties we want from zobrist keys, but we certainly want to minimize the probability that in n steps, that is n - 1 xors, we don't wind up with the same key for a different position. That suggests that we want a high average and minimum hamming distance. Of couse not too high: The distance between 000000 and 111111 is maximal, but they are not good keys, as aren't 101010 and 010101. A more thorough test than a hamming distance test, would be to find the minimum number of different keys that becomes zero when xor'ed. We want this number to be as big as possible. As for pseudo random number generators (PRNG's), these are of course important for the quality of the keys. The rand() in C sucks big time, mostly because most implementations in practical compilers suck, but also because you want to be able to at least debug on different platforms using the same keys. If you use hashkeys for opening book, you definately have to roll your own PRNG, because rand() is not guaranteed to be the same function on different platforms. You can easily find a good simple PRNG that is better than this by searching the net. /David
This page took 0.01 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.