Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Hamming distance and lower hash table indexing

Author: Tom Likens

Date: 12:11:57 09/04/03

Go up one level in this thread


On September 04, 2003 at 13:57:07, Dieter Buerssner wrote:

>On September 03, 2003 at 22:59:17, Tom Likens wrote:
>
>>On September 03, 2003 at 16:28:14, Dieter Buerssner wrote:
>>
>>>On September 03, 2003 at 13:43:13, Tom Likens wrote:
>>>
>>>>Getting the hamming distance in pseudo-code for N random numbers:
>>>>
>>>>1. Generate a random number (index=M)
>>>>
>>>>2. Compare it to the 0 ... M-1 valid random numbers alread saved
>>>>
>>>>   if (popcnt64(new_rand64 ^ array[0..M-1]) >= MIN_HAM) then OK
>>>>
>>>>3. If valid, save it into slot M
>>>>   If not valid (hamming distance is too small) goto 1
>
>BTW. This can give an infinite loop.

Absolutely, if you pick a Hamming distance that is too large it
will crunch for a *very* long time :)

>
>>>>4. Repeat until you have N random numbers
>>>
>
>>>They aren't random anymore, after you filtered them like that.
>>You're correct of course, the set of numbers generated with the above
>>algorithm is no longer pseudo-random and I should have been more precise
>>in my wording.
>
>I hope, I didn't sound too pedantic. It was just meant as a side note. I
>assumed, you were already aware of it. The main point of my posting was, to give
>a reference to that earlier discussion.

Trust me, no offense taken.  I *really* was glad that you pointed out
the earlier discussion.

>I tried different PRNGs (including Mersenne twister) of different quality, and
>could not see any change (besides noise) in some test suites.
>
>Regards,
>Dieter

I ran some experiments last night and actually was flabbergasted at
how many collisions I saw in my repetition hash table when I only
used 4k entries.  It was enough that it made me wonder how it ever
worked :(  Increasing the size of the table reduced the collisions,
but it was still eye-opening.

I think my strategy going forward is to test, test (and test!) and
then set the values empirically.  And if I do have any epiphanies
then I will share them here.

take care,
--tom




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.