ldpc_toolbox/
rand.rs

1//! # Reproducible random functions
2//!
3//! This module uses the [`ChaCha8Rng`] RNG from the [rand_chacha] crate
4//! to achieve reproducible random number generation.
5//!
6//! # Examples
7//! ```
8//! # use ldpc_toolbox::rand::Rng;
9//! # use ldpc_toolbox::rand::*;
10//! let seed = 42;
11//! let mut rng = Rng::seed_from_u64(seed);
12//! assert_eq!(rng.next_u64(), 12578764544318200737);
13//! ```
14use rand_chacha::ChaCha8Rng;
15pub use rand_chacha::rand_core::{RngCore, SeedableRng};
16
17/// The RNG used in throughout this crate for algorithms using pseudorandom
18/// generation.
19pub type Rng = ChaCha8Rng;