Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How to create a set of random integers for hashing?

Author: Robert Hyatt

Date: 06:34:37 10/18/98

Go up one level in this thread


On October 18, 1998 at 05:46:50, Ed Schröder wrote:

>Since ages I use the following formula for creating a set of random
>integers for hashing at program start:
>
>#define LENGTH 64*12
>
>int random [LENGTH];
>
>int a,b,c,d,x;
>
>srand(9);                    // initialize prime number
>
>for (x=0; x<LENGTGH; x++)
> { a=rand(); b=rand(); if (b & 1) a=a | 0x8000;
>   c=rand(); d=rand(); if (d & 1) c=c | 0x8000;
>   random[x]=(a<<16)+c;
> }
>
>I wonder how good such a system is and how others do it.
>
>- Ed -


First, I don't use "rand()" at all.  I ran some tests on it when
I started the crafty project and didn't like the result.  Instead, I
took the 32 bit random number generator from the well-known numerical
book "Numerical Recipes".  It is far better, and you can certainly take
the source to this directly from crafty since this piece of code is
also public domain.

I use 64 bit random numbers for hashing and ran a lot of hamming distance
tests to be sure the numbers looked ok, and was satisfied...



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.