caution about random number seeding

Discussion of chess software programming and technical issues.

Moderator: Ras

bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: caution about random number seeding

Post by bob »

Daniel Shawul wrote:
If you seed properly, there is no correlation if you use a good PRNG. Certainly not a LCG type. Best bet is to always test random numbers if the results are important. That's part of the programming assignment here. There are a number of pretty straight-forward tests one can do to feel fairly confident that the numbers are reasonable.
Mersenne twister with its big period should be fine. Also it uses an LCG to modify the passed seed
hence calling srand with processor rank should be fine. But LCGs like rand() has 2**32, divide that by N. Also correlation reduces the period say by atleast 1/5th , so overall only a small section
of the period is available to a single processor.

I think reproducibility for _timed_ MC simulations is somewhat difficult because you wouldn't know how many
simulations will be carried out in advance (i.e N) and also different processors may do unequal number of simulations (i.e not
necessarily N/16) . I have dropped that requirement for now. Anyway what could go wrong in a parallel montecarlo ?!
A ton of things. An unknown shared variable with no lock to protect access, passing a local address to another node is always a common thing students try, etc...