Skip to main content

Crate wowlab_engine_rng

Crate wowlab_engine_rng 

Source
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§

AccumulatedRng
State for chance-times-attempt-count RNG with an optional guaranteed cap.
RppmScaling
Current multiplicative inputs for RPPM scaling.
RppmTracker
RPPM (real procs per minute) state for one proc source.
ShuffledRng
A shuffled finite deck containing a fixed number of successful entries.
SimRng
Deterministic xorshift64 RNG seeded by FNV-1a over a simulation identity.
ThresholdTracker
State for an accumulated-threshold proc.

Enums§

AccumulatedOutcome
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], mirroring SimC’s rng().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 n randomly selected items to the front of items.