The OpenD Programming Language

Xoshiro256StarStar

xoshiro256** (XOR/shift/rotate) as described in Scrambled linear pseudorandom number generators (Blackman and Vigna, 2018). 64 bit output. 256 bits of state. Period of 2^^256-1. 4-dimensionally equidistributed. It is 15% slower than xoroshiro128+ but none of its bits fail binary rank tests and it passes tests for Hamming-weight dependencies introduced in the linked paper. From the authors:

<blockquote> This is xoshiro256** 1.0, our all-purpose, rock-solid generator. It has excellent (sub-ns) speed, a state (256 bits) that is large enough for any parallel application, and it passes all tests we are aware of. </blockquote>

A jump() function is included that skips ahead by 2^^128 calls, to generate non-overlapping subsequences for parallel computations.

Public domain reference implementation: .

import mir.random.engine.xoshiro;
alias Xoshiro256StarStar = XoshiroEngine!(ulong, 256, "**", 17, 45, 1, 7, 5, 9)

Examples

import mir.random /+: isSaturatedRandomEngine, rand+/;
import mir.random.engine.xoshiro : Xoshiro256StarStar;
import mir.math.common: fabs;

static assert(isRandomEngine!Xoshiro256StarStar);
static assert(isSaturatedRandomEngine!Xoshiro256StarStar);
auto gen = Xoshiro256StarStar(1234u);//Seed with constant.
assert(gen.rand!double.fabs == 0x1.b45d9a0e3ae53p-2);//Generate number from 0 inclusive to 1 exclusive.
assert(gen.rand!ulong == 15548185570577040190UL);
//Xoshiro256StarStar has a jump function that is equivalent
//to 2 ^^ 128 invocations of opCall.
gen.jump();
assert(gen.rand!ulong == 10759542936515257968UL);

Meta