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 16:34:46 PDT 2016
On Sunday, 15 May 2016 at 11:15:38 UTC, Joseph Rushton Wakeling
wrote:
> On Sunday, 15 May 2016 at 10:43:55 UTC, Joseph Rushton Wakeling
> wrote:
>> 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.
>
> Note, I've been mulling over this myself for a while, so I'll
> probably put something together in a future dxorshift release
> (and probably try to get it in Phobos ASAP, as it will be very
> helpful in avoiding the worst cases of the existing RNG
> functionality).
Wrapper implemented here, together with documentation and tests:
https://github.com/WebDrake/dxorshift/pull/1
N.B. I'm sticking with the explicit wrapper, because I want to be
really, really certain that what comes out is an input range
whose underling RNG can _never_ be copied by value.
More information about the Digitalmars-d-announce
mailing list