Quoting Vinzent Hoefler <[EMAIL PROTECTED]>:

> 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.

Well said.

Maybe you could use a solution where you call the MT random number
generator K times for each time the program is run.  You "throw away"
the first K-1 random values, and return the K'th random value as the
random value for this run.  Now, for each run, you compute K as some function of
(say) the process id, the current time-based seed from randomize, etc.

With this strategy, you would still be picking points off of a good random
sequence (from MT), although you would take the random value from a rather
poorly-chosen random point in the sequence.

If you can afford the time involved in letting K vary over a large range
(relative to the number of times you will call the random number generator),
then intuitively I think this would give a pretty good random sequence
across runs.

Jeff Miller
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to