Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Hash codes - how good is good enough?

Author: Ricardo Gibert

Date: 16:44:01 02/09/01

Go up one level in this thread


On February 09, 2001 at 10:39:09, Pat King wrote:

>On February 07, 2001 at 10:59:31, Pat King wrote:
>
>>I have seen it written here that with 64 bit Zobrist hashing, the perfect key
>>should change 32 bits. When I had what I thought to be hashing problems, I
>>captured some stats on my hash keys. I found that most of them changed 28-36
>>bits (within 4) with a few outliers as far as 13 bits from "perfection". I also
>>checked that I was not generating duplicate keys. How good or bad is this?
>>Should I work on the average, or the outliers? Any comments appreciated :)
>>
>>Pat
>Thanks to all for your thoughtful replies. For what it's worth, the only change
>I've made is to generate a key set with hamming distance 31-33, with a
>significant improvement in hash performance (thanks to Ricardo for providing a
>reasonable argument to justify the 32 bit standard). I have yet to compare this
>set with Rob's 16 bit criteria for XORing any 2 keys.
>
>Pat

31-33 is too narrow a range and suggests a bug to me. The following is the
algorithm I use:

int main(void)
{
	int i, j, c;
	hash64 a[DIM];

	seed_rnd64();
	a[0] = 0;   // to exclude zero and near zero numbers.
	for (i = 1; i < DIM; i++)
	{
		a[i] = rnd64();
		j = 0;
		while (j < i)
		{
			c = count(a[i]^a[j]);
			if (c < 22 || c > 42)
			{
				a[i] = rnd64();
				j = 0;    // don't forget to do this!
			}
			else
			{
				j++;
			}
		}
		printf("%4i ", i);
	}
	return 0;
}





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.