Optionally, a random number state - if not given we default construct the the builtin state RngStateBuiltin.
Optional
state: RngStateCreate 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.
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