Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Random keys and hamming distance

Author: Will Singleton

Date: 14:01:17 08/17/02

Go up one level in this thread


On August 17, 2002 at 07:04:18, Gerd Isenberg wrote:

>On August 16, 2002 at 23:26:08, James Swafford wrote:
>
>>
>>I'm in the process of tracking down some hashing problems, and
>>I'm starting with my Zobrist keys.  For each piece (i.e. bp, wp,
>>wr, ...) I have 64 keys.  I have 65 keys for "ep square", two
>>for "player to move", 16 for castling rights.  All keys are 64 bits.
>>
>>I just did a test to find the minimum hamming distance among
>>all keys, and it was 14 bits.  That seems a bit low.
>>
>>I think the way I'm doing 64 bit random number generation sucks.
>>Here it is:
>>
>>Bitmap RandomBitmap(void)
>>{
>>   Bitmap r1,r2;
>>
>>   r1=Random32();
>>   r2=Random32();
>>
>>   return ((r1<<32)|r2);
>>}
>>
>>
>>Ok, someone please confirm that this sucks and tell me a better
>>way. :)
>>
>>I'm also interested in hearing what others are getting for min
>>hamming distance between keys.
>>
>>--
>>James
>
>I also get a min hamming distance of 14 with this shift left 32. The average
>hamming distance is 31. IMHO it's fine.
>

Did you test for randomness also?  In my tests, combining 2 32-bit ints results
in a pretty severe bunching of numbers.  I did a graphical look at all the
generated numbers (just stuck them on Excel), and the difference was startling.

Will



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.