Author: Francesco Di Tolla
Date: 03:05:10 04/16/99
Go up one level in this thread
On April 15, 1999 at 02:48:10, Andreas Stabel wrote:
>On April 12, 1999 at 19:44:51, James Swafford wrote:
>
>>
>>My opening book relies on a random number generation to
>>choose among book entries. Windows random( ) function
>>leaves a lot to be desired, even when reseeded using the
>>system timer before each call.
>>
>>I'm interested in hearing what other programmers are doing
>>for _random_ number generation.
>>
>>--
>>James
>
>Here is my C conversion of the Mersenne Twister which is supposed to be one
I think that any random number generator that gives a flat ditribution is good
for chess opening books. What changes from one generator to another is in
general it's pereodicity and it's correlations. Of course all generators produce
a finite sequence which will repeat itself after a given period and furthermore
the show internal correlations such that if you, e.g., plot pair of numbers
generated in sequence as (x,y) points you'll se some pattern.
But for chess purposes this is not an issue. You just need to see all the lines
with the same freuqeuncy.
For chess purposes a cheap and dirty generator like
#define A 1664525C
#define C 1013904223
inline unsigned long myRand(unsigned long x)
{
return(x*A+C);
}
is enough. This has a period of 2^32 ~ 10^10, which should be enough for your
purposes, since I doubt you'll have to descibe more than 10^10 opening lines.
Remember: the first time you call give any X!=0 otherwise it will never produce
anything but 0!
regards
Franz
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.