MersenneTwisterEngine class

A configurable implementation of the Mersenne Twister.

This implementation is portable for both the Dart VM and for Dart for the Web.

Constructors

MersenneTwisterEngine.custom({required int w, required int r, required int n, required int m, required Int64 a, required int u, required Int64 d, required int s, required Int64 b, required int t, required Int64 c, required int l, required Int64 f, required Int64 f1, required Int64 f2})
MersenneTwisterEngine.w32()
MersenneTwisterEngine.w64()

Properties

a → Int64
Coefficients of the rational normal form twist matrix.
final
b → Int64
Tempering mask.
final
c → Int64
Tempering mask.
final
d → Int64
Tempering mask.
final
f → Int64
Initialization multiplier.
final
f1 → Int64
Initialization multiplier when seeding from a sequence.
final
f2 → Int64
Initialization multiplier when seeding from a sequence.
final
hashCode int
The hash code for this object.
no setterinherited
l int
Tempering right shift amount.
final
m int
Recurrence offset.
final
max BigInt
The maximum value returnable by call().
latefinal
n int
Degree of recurrence.
final
r int
Separation point of a word (the "twist value").
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
s int
Tempering left shift amount.
final
t int
Tempering left shift amount.
final
u int
Tempering right shift amount.
final
w int
Word size.
final

Methods

call() BigInt
Returns the next random number in the range 0, max.
genRandReal1() double
Returns the next random double in the closed interval [0, 1].
genRandReal2() double
Returns the next random double in the half-open interval [0, 1).
genRandReal3() double
Returns the next random double in the open interval (0, 1).
init(Int64 seed) → void
Initializes the MersenneTwisterEngine from a seed.
initFromSequence(List<Int64> key) → void
Initializes the MersenneTwisterEngine from a sequence.
nextInt64() → Int64
Returns the next random number.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaultSeed → const int