Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Hash Algorithm, maximizing distance between inputs?

Author: Robert Hyatt

Date: 18:44:23 02/02/98

Go up one level in this thread


On February 02, 1998 at 21:26:16, Brian McKinley wrote:

>I am creating hash keys using what I assume is a common technique
>suggested to me by Robert Hyatt.  I generated 13 * 64 random numbers (64
>bit in my case) and xor values together for each square depending on the
>piece and color or lack of a piece on each square.  I then xor an
>additional value based on flags for empassant and castling status.  The
>hash key is determined by using the first (n) bits from the resulting
>value depending on the size of the hash table.  This is working much
>better (translate faster) than what I was doing before, but the
>resulting distribution in the hash table is not very even.  Has anyone
>investigated using numbers that are not randomly generated to maximize
>the distance between inputs.  My math skills are not up to the
>challenge.
>
>--Brian

First, a key point:

  Uniformly distributed random numbers are *not* really uniformly
  distributed, as you might think of the term "uniform."  If they
  were "perfectly uniform" they would *not* be random at all.

you can play games with the random numbers.  Ideal test is to compute
the
"hamming distance" between each pair of numbers.  you'd like to see 32
(the number of bits that each two numbers differ by).  if you get some
0's,
1's or 2's, you have problems and I'd toss those numbers out...

Burton Wendroff and Tony Warnock wrote a paper a couple of years back in
the JICCA that discussed a better way of initializing the random number
array.  I don't do this, but it should be better...



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.