Mir Random [WIP]

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 23 06:12:04 PST 2016


On Wednesday, 23 November 2016 at 10:57:04 UTC, Joseph Rushton 
Wakeling wrote:
> struct MyRNG
> {
>     void popFront() { /* update internal state */ }
>
>     UIntType front() @property { return /* whatever part of 
> internal state */; }
>
>     UIntType opCall()
>     {
>         this.popFront();
>         return this.front;
>     }
> }

xorshift128+ returns a temporary value computed during state 
update, so it can't efficiently separate font from popFront. Also 
this API is prone to reuse some values and discard others, call 
popFront after front.


More information about the Digitalmars-d mailing list