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

bearophile bearophileHUGS at lycos.com
Wed Mar 19 17:39:42 PDT 2014


Joseph Rushton Wakeling:

> No, but it's planned.  Jerro wrote quite a nice one in the 
> course of his work on the Ziggurat algorithm, and I'm sure he'd 
> be happy for me to adapt it accordingly.

Note: I meant a simple but very fast function that generates just 
one value in [0.0, 1.0] (not a range).


> I don't object to rewriting the names if there's a valid case 
> for it, but it does seem to me to be important to try and match 
> as much as possible the names that are already out there in 
> std.random.

It's the best chance to improve naming, so do not throw it away 
for nothing:
https://d.puremagic.com/issues/show_bug.cgi?id=9106


> The idea is to minimize the amount of rewriting anyone will 
> have to do to adapt their code,

If you want you can keep a deprecated randomShuffle alias name 
for some time in std.random2.


> Besides, while std.random2.adaptor.randomShuffle may be the 
> fully-qualified name, in practice, no one will write all that 
> out, so the redundancy is less bad;

I agree. But better to improve names when you have a (the only) 
chance.


> However, I do think that merging it into Phobos (assuming all 
> other factors are OK) may have to be conditional on 
> improvements in the available allocation strategies.

We will probably have the nice Andrei's allocators in Phobos, but 
not in a short time. So I suggest to not rely on them for 
std.random2.

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list