Module rng

Module rng 

Source
Expand description

Thread-local random number generation for simulation.

This module provides deterministic randomness through thread-local storage, enabling clean API design without passing RNG through the simulation state. Each thread maintains its own RNG state, ensuring deterministic behavior within each simulation run while supporting parallel test execution.

Functionsยง

get_current_sim_seed
Get the current simulation seed.
reset_sim_rng
Reset the thread-local simulation RNG to a fresh state.
set_sim_seed
Set the seed for the thread-local simulation RNG.
sim_random
Generate a random value using the thread-local simulation RNG.
sim_random_f64
Generate a random f64 in the range [0.0, 1.0) using the simulation RNG.
sim_random_range
Generate a random value within a specified range using the thread-local simulation RNG.
sim_random_range_or_default
Generate a random value within the given range, returning the start value if the range is empty.