Expand description
Deterministic random streams and stochastic sampling primitives for the engine.
use wowlab_engine_rng::{SimRng, proc_chance};
let mut rng = SimRng::for_iteration(42, "chunk-0", 7);
let mut draw = || rng.next_f64();
let procced = proc_chance(&mut draw, 0.25);
assert_eq!(procced, SimRng::for_iteration(42, "chunk-0", 7).next_f64() < 0.25);Modules§
- rng 🔒
- stochastic 🔒
- Stochastic sampling primitives layered on
crate::SimRng.
Structs§
- Accumulated
Rng - State for chance-times-attempt-count RNG with an optional guaranteed cap.
- Rppm
Scaling - Current multiplicative inputs for RPPM scaling.
- Rppm
Tracker - RPPM (real procs per minute) state for one proc source.
- Shuffled
Rng - A shuffled finite deck containing a fixed number of successful entries.
- SimRng
- Deterministic xorshift64 RNG seeded by FNV-1a over a simulation identity.
- Threshold
Tracker - State for an accumulated-threshold proc.
Enums§
- Accumulated
Outcome - Result of one accumulated-RNG attempt.
Functions§
- accumulated_
proc_ chance - Rolls linearly accumulated RNG and resets the failure count after success.
- ppm_
proc_ chance - Converts a classic procs-per-minute rate into one swing’s proc probability.
- prd_
constant - Converts an average fractional proc rate into a pseudo-random distribution constant.
- prd_
constant_ capped - Converts an average fractional proc rate into a capped pseudo-random distribution constant.
- proc_
chance - Rolls a proc with the given fractional probability.
- roll_
range - Draws uniformly from the closed interval
[low, high], mirroringSimC’srng().range(a, b). - roll_
rppm - Rolls an RPPM check with DBC-selected scaling and bad-luck protection.
- roll_
threshold - Adds one trigger increment and reports whether the threshold proc occurred.
- roll_
tier - Returns the index of the first cumulative threshold above the RNG draw.
- seed_
prefix - Pre-computes the FNV-1a prefix for
(seed_base, chunk_id). - shuffle_
pick - Moves up to
nrandomly selected items to the front ofitems.