Optionally, a random number state - if not given we default construct the the builtin state RngStateBuiltin.
Optional
state: RngStateGet the entire internal state of a generator
The number of random number draws available to replay.
Generate a single random number on the interval [0, 1], updating whatever internal state the generator uses.
Create a new RngStateReplay random number state that will replay the values from this generator.
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
The array of values drawn by this generator
Generated using TypeDoc
Basic random number state class, to be passed to distribution functions (e.g., normal. The base class does not implement any draws though, so use a specialisation such as RngStateBuiltin or create a less terrible one.
We provide several concrete state clases that can be used:
RngStateBuiltin: Uses
Math.random()
and can't be seeded, saved, restored and has dubious statistical and predictibility propertiesRngStateAlea: Uses the "Alea" algorithm, and can be seeded, saved, restored and has better statistical properties (but is still predictable)
RngStateObserved: Wraps any
RngState
-implementing class and allows observation of the draws, useful for testing.RngStateReplay: Replays the state of any observed state