gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnugo-devel] rand() % n


From: Gunnar Farnebäck
Subject: Re: [gnugo-devel] rand() % n
Date: Thu, 13 May 2004 23:50:46 +0200
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.3 (sparc-sun-solaris2.9) MULE/5.0 (SAKAKI)

David wrote:
> As a physics guy who does Monte Carlo simulations, where the quality
> of the random number generator (RNG) is a real issue, I am wondering:
> 
> How often is the RNG called in Gnu Go?

Infrequently. In fact both speed and random quality are mostly
non-issues.

> I am having a problem imagining that the specific details of the RNG
> are really important. It seems that most any reasonable RNG, even
> a simple and direct linear congruential generator with "proper"
> parameters, should be fine.

There are exactly two important issues with the random number
generator in GNU Go:

1. The quality must be good enough to avoid overly frequent collisions
   in the Zobrist hashing. (Where all bits are used, by the way.)

2. The implementation must behave identically on different platforms.
   If it doesn't we can't hope to get consistent regression results
   and bugs will become more difficult to reproduce.

Because of 2 we can't use rand() from libc and providing an own RNG is
by far the easiest solution to get full portability and platform
independence. As for the choice of RNG I agree that about any
algorithm would be good enough.

/Gunnar




reply via email to

[Prev in Thread] Current Thread [Next in Thread]