On 20/07/12 11:47, Andrea Fontana wrote:
I think it would be a good idea to replace it with
complementary-multiply-with-carry (cmwc). CMWC is faster (use simpler math), has
a longer period (standard implementation has a 2^131104 period vs 2^19937 of
current MT implementation in phobos) and passed diehard tests (mt passes them 
too)

That reminds me ... it might be an idea to implement the Diehard tests for D, as part of a test suite for std.random.

Rigorously testing pseudorandom functionality is not really my area of expertise, but it's something that is important to do for any code that might have a scientific application (quite early on in my experience of writing simulations, I had the lovely experience of having to rewrite and rerun a whole load of code because of poor RNG choice; fortunately it didn't affect anything that had been published). Some years ago, there was an observed departure from randomness in the default MATLAB RNG which must have resulted in all kinds of false conclusions and results being out there in the scientific literature.

On the subject of default RNG -- the use of Mersenne Twister is very widespread as a default method (used in MATLAB/Octave, R, and it's the recommended method in GSL and Boost). So it may be a good default choice for D just by virtue of easy comparison with other tools.

Reply via email to