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

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Wed Mar 19 17:55:59 PDT 2014


On Thursday, 20 March 2014 at 00:39:43 UTC, bearophile wrote:
> Note: I meant a simple but very fast function that generates 
> just one value in [0.0, 1.0] (not a range).

There will be both. :-)

Off the top of my head I'm not sure whether the interval will be 
[0.0, 1.0], [0.0, 1.0) or whether it might be possible to make it 
work with arbitrary boundaries.  If I recall right, most 
uniform01 implementations are [0.0, 1.0) ... ?

> 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
>
> If you want you can keep a deprecated randomShuffle alias name 
> for some time in std.random2.

Yes, in that case, I'd be happy to make the change (and maintain 
the old names via aliases).  Thanks for pointing me to the bug 
report; I'd forgotten that this was an open issue :-)

> 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.

No, I don't intend to rely on them arriving soon.  But while of 
course a random3 is always possible too, I'd rather not be faced 
with the situation of needing breaking changes to handle support 
for alternative allocation strategies.  So if necessary, I'd 
rather maintain std.random2 outside of Phobos for a while and get 
things right when it finally lands, than push it in too early and 
need to make breaking changes.


More information about the Digitalmars-d-announce mailing list