The OpenD Programming Language

Xorshift1024StarPhi

Define XorshiftStarEngine with well-chosen parameters for large simulations on 64-bit machines.

Period of (2 ^^ 1024) - 1, 16-dimensionally equidistributed, and faster and statistically superior to Mt19937_64 while occupying significantly less memory. This generator is recommended for random number generation on 64-bit systems except when 1024 + 32 bits of state are excessive.

As described by Vigna in the 2014 draft of his paper published in 2016 detailing the xorshift* family, except with a better multiplier recommended by the author as of 2017-10-08.

Public domain reference implementation: .

import mir.random.engine.xorshift;
alias Xorshift1024StarPhi = XorshiftStarEngine!(ulong, 1024, 31, 11, 30, 0x9e3779b97f4a7c13uL)

Examples

import mir.random.engine : EngineReturnType, isSaturatedRandomEngine;
auto rnd = Xorshift1024StarPhi(12434UL);
auto num = rnd();
assert(num != rnd());

static assert(is(EngineReturnType!Xorshift1024StarPhi == ulong));
static assert(isSaturatedRandomEngine!Xorshift1024StarPhi);

//Xorshift1024StarPhi has a jump function that is equivalent
//to 2 ^^ 512 invocations of opCall.
rnd.jump();
num = rnd();
assert(num != rnd());

Meta