[Issue 6594] New: Xorshift as default generator

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 2 03:11:41 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6594

           Summary: Xorshift as default generator
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-09-02 03:11:35 PDT ---
In the std.random module I suggest to use Xorshift as default generator (the
one used when a generator is not specified, like in uniform(0,5)).

Two or three times I have had to hunt for performance problems in D code, and
in the end the cause was the high-quality but slow Mersenne Twister used on
default. Replacing it with the Xorshift has solved my problems, because it is
significantly faster. And the quality of numbers generated by Xorshift was
enough for all my purposes, it's better than the linear congruences generator.

The disadvantage of using Xorshift on default is that where you need really
high quality random numbers, the default is not enough any more. But I think
such situations are not common. If in your code you need very high quality
random numbers, then I think you know it, and you know to use the Mersenne
Twister (or even better).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list