Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How do you insure that Hash Table entries are correct?

Author: Dieter Buerssner

Date: 09:20:20 09/17/00

Go up one level in this thread


On September 17, 2000 at 10:11:19, Robert Hyatt wrote:

>On September 17, 2000 at 06:35:17, Dieter Buerssner wrote:
>
>>On September 16, 2000 at 23:54:19, Robert Hyatt wrote:

>>>what random() function are you using?   IE stock random() doesn't have any
>>>arguments.  If it is a seed, there are known good and bad seeds.  In almost
>>>_all_ cases, you want the seed to be odd, and usually prime.
>>
>>Hmm. I don't believe this. Almost all Pseudo random number generators I know
>>(there are *many*) don't depend on the seed. Even the toy PRNGs, like the
>>linear congruential generator, that often is the system rand(), doesn't depend
>>on the seed. It has an internal state which is initialize by the seed. Then it
>>will walk through all possible numbers, independent of the initial seed.
>>A different seed just means, that you start at a different point in the
>>produced sequence of pseudo random numbers.

>Most do some sort of multiplication.  If the seed is even, you just cut
>the period of the rng by 50%.

Can you give me a pointer to such a PRNG? This might be a nice addition to
my collection of deficient PRNGs ;)

I am not aware of any PRNG with such an deficiency yet. In my collection of
over 50 PRNGs there is none. I would assume, that a PRNG that only gets
to even states with even seed, would also allways get to uneven states
with uneven seed. Many PRNGs, that use multiplication also add an odd constant.
Typical RNGs that use multiplication are linear congruential generators.
They use x(n+1) = (x(n)*a + b)%m. Often the low significant bits are shifted
out. For suitable a, b, m, they don't have this
problem. The one I have posted also uses multiplication, and does not suffer
from this problem. The ones in Numerical Recipes, used with the correct seeding
routine don't have the problem either.

>However, it is speculation, since the normal C library routine random() doesn't
>have an argument.

I think one problem is, that there is no normal C library routine random().
(But that may depend on the definition of normal).
Many Unix C libraries have random without argument. (Which to my knowledge
comes from BSD Unix). It returns 31 bit random numbers. Many DOS based
C compilers come with random with argument, for generating a random number
in a specified range. Standard ISO-C doesn't have random at all. The only
function there is rand().

>>So I think Larry's problem is, that he doesn't use 64 bit hash values, but
>>rather uses only 15 bit hash values and has 49 zero bits.
>
>
>That will certainly kill him.  My rng came directly from "Numerical Recipes"
>and doesn't generate 15 bit numbers at all.  It generates a full 32 bit
>number that I call twice to make a 64 bit value.

To avoid misunderstandings. My comment was of course not about Crafty. I never
doubted that the lagged Fibonacci generator you use (and that was suggested
by Donald E. Knuth) is totally suitable for chess programming. It would even
work directly on 64 bit numbers, provided a state array with 64 bit numbers is
used.

As a side note. That PRNG fails an easy test for random numbers
(the duplicate birthday spacings test designed by George Marsaglia), in a
very spectacular fashion, and should therefor be used with caution for
simulations.

-- Dieter



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.