xoshiro128** — the interchangeable alternative to the default sohl.entity.random.Sfc32Rng, behind the same sohl.entity.random.Rng interface. 128-bit state across four 32-bit words; excellent statistical quality with a well-scrambled output stage.

All state is per-instance (no static or shared state), so it is reentrant and safe to run interleaved with any number of other generators.

Hierarchy (View Summary)

Constructors

Methods

  • A uniform die roll in [1, sides].

    Parameters

    • sides: number

      Number of faces; must be >= 1.

    Returns number

    An integer 1 <= n <= sides.

    If sides < 1.

  • A uniform integer in [min, max], inclusive on both ends.

    Parameters

    • min: number

      Inclusive lower bound.

    • max: number

      Inclusive upper bound; must be >= min.

    Returns number

    An integer min <= n <= max.

    If max < min.

  • 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.

    Parameters

    • seed: string | number | number[]

      A string, a single number, or the four state words directly.

    Returns void

  • Restore state previously produced by getState. Unlike seed, this sets the exact words with no re-mixing.

    Parameters

    • state: number[]

      The four state words to restore.

    Returns void

    If state does not hold four words.

  • A uniform integer in [0, bound), unbiased (rejection-sampled — no modulo/rounding skew, which matters on d100-scale hit-location tables).

    Parameters

    • bound: number

      Exclusive upper bound; must be >= 1.

    Returns number

    An integer 0 <= n < bound.

    If bound < 1.