The OpenD Programming Language

XoshiroEngine

Template for the xoshiro family of generators. See the paper introducing xoshiro and xoroshiro.

Xoshiro256StarStar and Xoshiro128StarStar_32 are aliases for XoshiroEngine instantiated with recommended parameters for 64-bit and 32-bit architectures, respectively.

struct XoshiroEngine (
UIntType
uint nbits
string scrambler
uint A
uint B
uint I
uint R
UIntType S
UIntType T
) if (
(
is(UIntType == uint) ||
is(UIntType == ulong)
)
&&
"**" == scrambler
&&
(
UIntType.sizeof * 8 * 4 == nbits ||
UIntType.sizeof * 8 * 8 == nbits
)
) {
enum bool preferHighBits;
}

Constructors

this
this(UIntType x0)

Initializes the generator with a seed.

Postblit

A postblit is present on this object, but not explicitly documented in the source.

Members

Functions

jump
void jump()

Jump functions are defined for certain UIntType, A, B combinations:

opCall
UIntType opCall()

Advances the random sequence.

popFront
void popFront()
seed
void seed(UIntType x0)

Compatibility with Phobos library methods. Presents this RNG as an InputRange.

Manifest constants

isRandomEngine
enum isRandomEngine;

Properties

front
UIntType front [@property getter]
save
typeof(this) save [@property getter]
empty
enum bool empty;

Compatibility with Phobos library methods. Presents this RNG as an InputRange.

Variables

isUniformRandom
enum bool isUniformRandom;

Compatibility with Phobos library methods. Presents this RNG as an InputRange.

max
enum UIntType max;

Largest generated value.

min
enum typeof(this.max) min;

Compatibility with Phobos library methods. Presents this RNG as an InputRange.

s
UIntType[nbits / (UIntType.sizeof * 8)] s;

State must not be entirely zero. The constructor ensures this condition is met.

Parameters

UIntType

uint or ulong

nbits

number of bits (128, 256, 512; must be 4x or 8x bit size of UIntType)

scrambler

"**" (in the future "+" may be added)

A

state xor-lshift

B

state rotate left

I

index of element used for output

R

output scramble rotate left

S

output scramble pre-rotate multiplier (must be odd)

T

output scramble post-rotate multiplier (must be odd)

Meta