MersenneTwister class
An implementation of the Mersenne Twister 19937 pseudo-random number generator.
Constructors
- MersenneTwister({int? seed})
- Initializes the random number generator from an optional seed.
-
MersenneTwister.from(List<
int> key) -
Initializes the random number generator from a sequence.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
) → int - An alias to genRandInt32.
-
genRandInt31(
) → int - Returns the next random integer in the range [0, (1 << 31) - 1)].
-
genRandInt32(
) → int -
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).
-
genRandRes53(
) → double - Returns a random double in the half-open interval [0, 1) with 53-bit resolution.
-
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
- The default seed.
- max → const int
- The maximum value returnable by call().