Expand description
Seeded random numbers for a deterministic simulation.
SimRng is a PCG32 (XSH RR, 64-bit state) written in this crate, so its
output is fixed by this file alone: same seed ⇒ same numbers on every
platform and every dependency version. It is serialisable so a game’s
state (and its RNG position) can be saved, rewound and replayed.
Game rules take a RandomSource, so tests can inject a ScriptedRng
that returns a given list of rolls.
Structs§
- Scripted
Rng - A
RandomSourcethat returns a fixed list of rolls, in order. For tests that need an exact trace of rolls. Percent rolls androll_belowdraws come from two separate lists. - SimRng
- The seeded simulation RNG, kept in the game’s state.
Traits§
- Random
Source - Where game rules get their random numbers from.