std.random and mersenne twister
Andrea Fontana
nospam at example.com
Fri Jul 20 07:11:16 PDT 2012
Il giorno ven, 20/07/2012 alle 16.05 +0200, Craig Dillabaugh ha scritto:
> On Friday, 20 July 2012 at 12:51:25 UTC, Andrea Fontana wrote:
> > CMWC is proven to be a valid method and it passes diehard
> > tests. It was
> > written by prof. George Marsiglia (he developed xorshift too -
> > included
> > in std.random). He was one of the best experts in PRNG.
> >
> > 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.
> > LCG is very widespread but d doesn't use it (phew!). If a user
> > know
> > difference between PRNG algorithms can use MT, but as default
> > for people
> > that use weak C rand() function as default (that neither passes
> > diehard
> > tests) it can just be a good improvement (why should we give
> > them MT
> > that is slower than CMWC if they neither know default rand()
> > weakness?)
> >
> > MT has a complex implementation, I hope std.random MT was
> > tested :)
> >
> > Il giorno ven, 20/07/2012 alle 13.16 +0200, monarch_dodra ha
> > scritto:
> >
> >> 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.
>
> But Mersenne Twister has a cooler name :o)
>
> 'Multiply with carry' is so blah. You'll need to come up with a
> sexy new name for it.
>
> Cheers,
> Craig
>
Marsaglia Tornado?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120720/d5599db3/attachment.html>
More information about the Digitalmars-d
mailing list