Constructs an Xoroshiro128Plus generator seeded with x0.
A postblit is present on this object, but not explicitly documented in the source.
This is the jump function for the generator. It is equivalent to 2^^64 calls to opCall(); it can be used to generate 2^^64 non-overlapping subsequences for parallel computations.
Advances the random sequence.
Compatibility with Phobos library methods. Presents this RNG as an InputRange.
Compatibility with Phobos library methods. Presents this RNG as an InputRange.
Compatibility with Phobos library methods. Presents this RNG as an InputRange.
Largest generated value.
Compatibility with Phobos library methods. Presents this RNG as an InputRange.
The lowest bit of this generator is an LFSR. The next bit is not an LFSR, but in the long run it will fail binary rank tests, too. The other bits have no LFSR artifacts. To provide some context, every bit of a Mersenne Twister generator (either the 32-bit or 64-bit variant) is an LFSR.
State must not be entirely zero. The constructor ensures this condition is met.
import mir.random.engine : isSaturatedRandomEngine; static assert(isSaturatedRandomEngine!Xoroshiro128Plus); auto gen = Xoroshiro128Plus(1234u);//Seed with constant. assert(gen() == 5968561782418604543);//Generate number. foreach (i; 0 .. 8) gen(); assert(gen() == 8335647863237943914uL); //Xoroshiro128Plus has a jump function that is equivalent //to 2 ^^ 64 invocations of opCall. gen.jump(); auto n = gen();
xoroshiro128+ (XOR/rotate/shift/rotate) generator. 64 bit output. 128 bits of state. Period of (2 ^^ 128) - 1.
Created in 2016 by David Blackman and Sebastiano Vigna as the successor to Vigna's extremely popular xorshift128+ generator used in the JavaScript engines of Google Chrome, Mozilla Firefox, Safari, and Microsoft Edge. From the authors:
<blockquote> This is the successor to xorshift128+. It is the fastest full-period generator passing BigCrush without systematic failures, but due to the relatively short period it is acceptable only for applications with a mild amount of parallelism; otherwise, use a xorshift1024* generator.
Beside passing BigCrush, this generator passes the PractRand test suite up to (and included) 16TB, with the exception of binary rank tests, as the lowest bit of this generator is an LFSR. The next bit is not an LFSR, but in the long run it will fail binary rank tests, too. The other bits have no LFSR artifacts.
We suggest to use a sign test to extract a random Boolean value, and right shifts to extract subsets of bits. </blockquote>
Public domain reference implementation: .