dxorshift: random number generators from the extended Xorshift family
    Joseph Rushton Wakeling via Digitalmars-d-announce 
    digitalmars-d-announce at puremagic.com
       
    Sun May 15 03:43:55 PDT 2016
    
    
  
On Sunday, 15 May 2016 at 10:35:11 UTC, Basile B. wrote:
> The "@disable this" is really a concern, because pointers have 
> to be used (for example if the seed comes from a program option 
> and that the gen is a global var then global var must be a 
> pointer to the stuff).
>
> I see that you are yourself affected by the issue because in 
> the unittest you must take the gen address to use it in take   .
>
> The main consequence is that they are unsable in @safe code !
The @safe side of things is obviously a concern, but having @safe 
code is not very helpful if you don't also have _statistical_ 
safety.  See what happens with phobos RNGs if you try,
     import std.stdio : writeln;
     import std.random : Random, unpredictableSeed
     import std.range : take;
     auto gen = Random(unpredictableSeed);
     gen.take(10).writeln;
     gen.take(10).writeln;
... ;-)
Probably the best way to handle this is to handle the 
take-the-address side of things by a @trusted wrapper that uses 
`return ref` to guarantee the pointer remains valid for the 
lifetime of the wrapper itself.
    
    
More information about the Digitalmars-d-announce
mailing list