Module rand
Expand description
Cryptographic pseudo-random number generation.
An application should create a single SystemRandom and then use it for
all randomness generation. See SystemRandom’s documentation for more
details.
§Example
use aws_lc_rs::{rand, rand::SecureRandom};
// Using `rand::fill`
let mut rand_bytes = [0u8; 32];
rand::fill(&mut rand_bytes).unwrap();
// Using `SystemRandom`
let rng = rand::SystemRandom::new();
rng.fill(&mut rand_bytes).unwrap();
// Using `rand::generate`
let random_array = rand::generate(&rng).unwrap();
let more_rand_bytes: [u8; 64] = random_array.expose();Structs§
- Random
- A random value constructed from a
SecureRandomthat hasn’t been exposed through any safe Rust interface. - System
Random - A secure random number generator where the random values come from the underlying AWS-LC libcrypto.
Traits§
- Randomly
Constructable - A type that can be returned by
aws_lc_rs::rand::generate(). - Secure
Random - A secure random number generator.