Construct a generator. With no seed it draws entropy from entropySeed; with a seed it is fully reproducible.
Optionalseed: string | number | number[]Optional string / number / four-word seed.
Snapshot the internal state so it can be restored with setState (e2e captures before an action, replays after).
A copy of the generator's state words — mutating it is safe.
Fully reset the stream to a known start (reset, not perturb). String
seeds hash through cyrb128, so seeding each unit test with its own name
gives an independent, reproducible stream for free.
A string, a single number, or the four state words directly.
The default SoHL generator:
sfc32(Small Fast Counter), 128-bit state across four 32-bit words. Small, fast, and statistically strong far beyond anything a tabletop system needs (passes PractRand to deep sizes).All state is held in the four instance fields — no static or shared state, so instances are fully independent and reentrant (see sohl.entity.random.Rng).
Remarks
mulberry32is an acceptable single-word fallback if the absolute minimum is ever wanted; it is not needed here. sohl.entity.random.Xoshiro128Rng is the interchangeable alternative behind the same interface.