On 20/07/12 14:51, Andrea Fontana wrote:
He also developed the "Marsiglia's Theorem" where he demonstrate that LCG (that
is the default algorithm for many languages  for ex: glibc and vc++ lib, ...)
has big issues.

C and C++ have the bad luck to have been created before many of the high-quality PRNGs were developed. A lot of scientific software now has MT as the default. I'd personally never heard of CMWC before this email exchange -- a nice discovery :-)

MT has a complex implementation, I hope std.random MT was tested :)

I doubt there's anything wrong with the MT implementation per se; it looks largely like a close match to that in the Boost C++ random library, and they certainly generate identical output. There is an issue with the seeding, that D's MT can only take a number as seed, not a sequence of numbers -- see:
http://forum.dlang.org/thread/jr0luj$1ctj$1...@digitalmars.com

But I agree that there should be a proper set of unittests for the PRNGs that really check their implementation.

Personally if there is a flaw in the current D random number generation, my money would be on the unpredictableSeed being responsible. It's a hunch rather than something I can justify technically, but the method of generating that seed looks too simple to me -- I'd be worried that for some PRNGs, different threads might wind up with correlated random sequences by accident, because the different unpredictableSeeds would not be different enough.

So, given that D looks to be gaining traction in various areas of scientific simulation, I think it'd be well worth trying to make sure that multithreaded pseudo-random number generation is really rigorously tested. Unfortunately I don't know what kinds of test would be appropriate here.

Reply via email to