The generator can be started from a "seed" (some small piece of data from which we'll derive a state) or from a state.
An initial seed; any truthy value will do. If not
given (and if state
is not given, then we seed using
Math.random()
Optional
state: number[]A state extracted from a previously initialised
copy of an RngStateAlea
generator; will be a length 4
array. If given, then seed must be null
.
Get the entire internal state of a generator
Generate a single random number on the interval [0, 1], updating whatever internal state the generator uses.
Set the seed of the generator; most generators should support this but RngStateBuiltin does not, and a cryptographically secure generator also may not.
Replace the entire internal state of a generator
Generated using TypeDoc
Random number generator based on the "Alea" algorithm of Johannes Baagøe; designed to produce acceptable quality random numbers at a reasonable speed given limitations of JavaScript's numbers.