1st draft of complete class-based std.random successor

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Thu Mar 20 13:49:33 PDT 2014


On Thursday, 20 March 2014 at 01:07:54 UTC, bearophile wrote:
> In Bugzilla probably there are many bug reports/enhancement 
> requests about std.random, so I suggest you to read them. Some 
> of them can be useful, while other are probably already 
> addressed in the current (or planned) std.random2.

Yes, indeed.  Quite a few of them _are_ addressed, I think, but 
now that I've got the essentials of the design laid out, I should 
be systematic and go through them.

> Another random one that was just commented by Infiltrator:
> https://d.puremagic.com/issues/show_bug.cgi?id=5901

Well, you already have the NormalDistribution in 
std.random2.distribution ;-)  I clearly can also implement 
function-only Box-Muller variant that spends 2 random variates to 
generate a single normally-distributed value, as this doesn't 
have the problem of needing to store state or allocate memory, so 
I will add that at some stage.

I'm reluctant to add a specific fastRandom because I think here 
the better option is a really nice range-based algorithm that can 
generate high quality variates at speed (e.g. the Ziggurat 
algorithm is a good candidate here).  There's a quite good review 
of different algorithms here:
http://www.cse.cuhk.edu.hk/~phwl/mt/public/archives/papers/grng_acmcs07.pdf

But of course I'm open to arguments here :-)


More information about the Digitalmars-d-announce mailing list