import mir.random : isSaturatedRandomEngine, rand; import mir.random.engine.xoshiro : Xoshiro128StarStar_32; static assert(isSaturatedRandomEngine!Xoshiro128StarStar_32); auto gen = Xoshiro128StarStar_32(1234u);//Seed with constant. assert(gen.rand!uint == 1751597702U); //Xoshiro128StarStar_32 has a jump function that is equivalent //to 2 ^^ 64 invocations of opCall. gen.jump(); assert(gen.rand!uint == 1248004684U);
32-bit-oriented xoshiro** with 128 bits of state. In general Xoshiro256StarStar is preferable except if you are tight on space <em>and</em> know that the generator's output will be consumed 32 bits at a time. (If you need a generator with 128 bits of state that is geared towards producing 64 bits at a time, Xoroshiro128Plus is an option.) 32 bit output. 128 bits of state. Period of 2^^128-1. 4-dimensionally equidistributed. None of its bits fail binary rank tests and it passes tests for Hamming-weight dependencies introduced in the xoshiro paper. From the authors:
<blockquote> This is xoshiro128** 1.0, our 32-bit all-purpose, rock-solid generator. It has excellent (sub-ns) speed, a state size (128 bits) that is large enough for mild parallelism, and it passes all tests we are aware of. </blockquote>
A jump() function is included that skips ahead by 2^^64 calls, to generate non-overlapping subsequences for parallel computations.
Public domain reference implementation: .