The OpenD Programming Language

LinearCongruentialEngine

Linear Congruential generator.

Constructors

this
this(Uint x0)

Constructs a LinearCongruentialEngine generator seeded with x0.

Postblit

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

Members

Functions

opCall
Uint opCall()

Advances the random sequence.

Manifest constants

isRandomEngine
enum isRandomEngine;

Variables

increment
enum Uint increment;

The parameters of this distribution. The random number is x = (x * multiplier + increment) % modulus.

max
enum Uint max;

Highest generated value (modulus - 1 - bool(c == 0)).

modulus
enum Uint modulus;

The parameters of this distribution. The random number is x = (x * multiplier + increment) % modulus.

multiplier
enum Uint multiplier;

The parameters of this distribution. The random number is x = (x * multiplier + increment) % modulus.

preferHighBits
enum bool preferHighBits;

The low bits of a linear congruential generator whose modulus is a power of 2 have a much shorter period than the high bits. Note that for LinearCongruentialEngine, modulus == 0 signifies a modulus of 2 ^^ (Uint.sizeof*8) which is not representable as Uint.

Meta