Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: 64-Bit random numbers

Author: martin fierz

Date: 04:00:56 10/29/03

Go up one level in this thread


On October 28, 2003 at 15:01:40, Gerd Isenberg wrote:

>On October 28, 2003 at 14:50:35, Martin Schreiber wrote:
>
>>Hi,
>>
>>For my hash tables I need 64 bit random numbers, but I don't know the source
>>code.
>>I use Dev-C++.
>>Can anybody help me?
>>
>>Martin
>
>This simple one works quite well
>
>UINT32 HashRand32()
>{
>    static UINT32 r = 0;
>    return (r = 1664525L*r + 1013904223L);
>}
>
>...
>hashval = HashRand32();
>hashval = (hashval << 32) | HashRand32();

i use a similar concatenation of random numbers generated with the C rand()
function.

i have never believed all the stuff about "bad" or "good" random numbers for
hashing purposes (of course, for other things it's different...). i also don't
believe this "hamming distance" stuff. i'd be very surprised if any of this made
any difference in practice. has anybody ever tested this?

cheers
  martin



This page took 0.01 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.