micro_traffic_sim_core 0.1.9

Core library for microscopic traffic simulation via cellular automata.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Deterministic random number generation for testing.
//! 
//! This module provides a drop-in replacement for `rand::thread_rng()` that uses
//! a fixed seed during testing to ensure reproducible results.
#[cfg(test)]
use rand::Rng;

#[cfg(not(test))]
pub use rand::rng;

#[cfg(test)]
pub fn rng() -> impl Rng {
    // Return a fixed-seed RNG for testing
    use rand::SeedableRng;
    rand::rngs::StdRng::seed_from_u64(42)
}