The OpenD Programming Language

MersenneTwisterEngine

The Mersenne Twister generator.

Constructors

this
this(UIntType value)

Constructs a MersenneTwisterEngine object.

Members

Functions

popFront
void popFront()

Advances the generator.

seed
void seed(UIntType value)

Seeds a MersenneTwisterEngine object. Note: This seed function gives 2^w starting points (the lowest w bits of the value provided will be used). To allow the RNG to be started in any one of its internal states use the seed overload taking an InputRange.

seed
void seed(T range)

Seeds a MersenneTwisterEngine object using an InputRange.

Properties

front
UIntType front [@property getter]

Returns the current random value.

save
typeof(this) save [@property getter]

Variables

defaultSeed
enum UIntType defaultSeed;

The default seed value.

empty
enum bool empty;

Always false.

initializationMultiplier
enum UIntType initializationMultiplier;

Parameters for the generator.

isUniformRandom
enum bool isUniformRandom;

Mark this as a Rng

maskBits
enum size_t maskBits;

Parameters for the generator.

max
enum UIntType max;

Largest generated value.

min
enum UIntType min;

Smallest generated value (0).

shiftSize
enum size_t shiftSize;
stateSize
enum size_t stateSize;
temperingB
enum UIntType temperingB;
temperingC
enum UIntType temperingC;
temperingD
enum UIntType temperingD;
temperingL
enum size_t temperingL;
temperingS
enum size_t temperingS;
temperingT
enum size_t temperingT;
temperingU
enum size_t temperingU;

Parameters for the generator.

wordSize
enum size_t wordSize;
xorMask
enum UIntType xorMask;

Parameters for the generator.

Examples

// seed with a constant
Mt19937 gen;
auto n = gen.front; // same for each run
assert(n == 3499211612);

// Seed with an unpredictable value
gen.seed(unpredictableSeed);
n = gen.front; // different across runs

Meta