std.random and mersenne twister

monarch_dodra monarchdodra at gmail.com
Fri Jul 20 04:16:37 PDT 2012


On Friday, 20 July 2012 at 09:47:52 UTC, Andrea Fontana wrote:
> I read that default RNG in phobos is Mersenne Twister.
>
> 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)
>
> And of course it's very easy to implement:
> http://en.wikipedia.org/wiki/Multiply-with-carry#Implementation

I'd say the problem is that it is not a very widespread or known 
PRNG.

While I wouldn't be against adding it to the library ("I see no 
reason not to add it"), making it the _default_ PRNG is a whole 
other story.

Users that choose "default" want something reliable, documented, 
trustworthy etc...

Multiply With Carry seems like it is Cutting Edge to me, not yet 
widespread, known or tested. I'd say it should only be used by 
those that explicitly request it's usage.


More information about the Digitalmars-d mailing list