[fpc-pascal] Random numbers

Vinzent Hoefler JeLlyFish.software at gmx.net
Mon Mar 6 08:57:10 CET 2006


On Friday 03 March 2006 11:06, Antal wrote:

> Maybe a bit shifting or some aritmetical function can help to
> obtain a more random "looking" number.

No. Don't do that:

|Random numbers should not be generated with a method chosen at random.
|       -- Donald E. Knuth

|The generation of random numbers is too important to be left to chance.
|        -- Robert R. Coveyou, Oak Ridge National Laboratory, 1969

The Mersenne Twister Free Pascal uses is one of the best PRNGs known 
today, it just has to be used the right way. But calling it from 
several threads and "randomly" overwriting its state array is 
definitely not the right way to use it.


Vinzent.




More information about the fpc-pascal mailing list