Bit generators: the low level sources of randomness.
Every bit generator exposes the same interface:
nextUint32()a uniformly distributed unsigned 32-bit integer.random()a uniformly distributed double in [0, 1) with 53 bits of resolution.getState()/setState(state)to snapshot and restore the stream.clone()an independent copy positioned at the same point of the stream.
All generators are implemented with 32-bit integer arithmetic only (no BigInt), so they are fast in every JavaScript engine.
- Source:
Classes
Members
(static, constant) BIT_GENERATORS :Object.<string, function()>
Registry of the bit generators by name.
Type:
- Object.<string, function()>
- Source:
Methods
(static) createBitGenerator(nameopt, seedopt) → {BitGenerator}
Creates a bit generator by name.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name |
string |
<optional> |
'xoshiro128**' | One of |
seed |
number | bigint | string | Array.<number> |
<optional> |
Seed. Random if omitted. |
- Source:
Returns:
- Type
- BitGenerator