Expand description
Documentation for the crate::random module.
Random number generation utilities.
Provides both a simple pseudo-random generator Prng and a
cryptographically secure alternative CryptoRng. The
SliceRandom trait offers shuffling of slices using any RNG
implementing Rng.
use rustframe::random::{rng, SliceRandom};
let mut rng = rng();
let mut data = [1, 2, 3, 4];
data.shuffle(&mut rng);
assert_eq!(data.len(), 4);Re-exports§
pub use crypto::crypto_rng;pub use crypto::CryptoRng;pub use prng::rng;pub use prng::Prng;pub use random_core::RangeSample;pub use random_core::Rng;pub use seq::SliceRandom;
Modules§
- crypto
- Cryptographically secure random number generator.
- prelude
- prng
- A tiny XorShift64-based pseudo random number generator.
- random_
core - Core traits for random number generators and sampling ranges.
- seq
- Extensions for shuffling slices with a random number generator.