Skip to main content

new_deterministic_rng

Function new_deterministic_rng 

Source
pub fn new_deterministic_rng(seed: [u8; 32]) -> LibQRng
Expand description

Create a new deterministic RNG instance

This function creates a deterministic RNG suitable for testing and reproducible operations. Output is a ChaCha20 stream from seed. Unpredictability is only as strong as the seed; use new_secure_rng for production cryptography.

§Arguments

  • seed - 32-byte ChaCha20 key (same interpretation as ChaCha20Rng::from_seed)

§Examples

use lib_q_random::new_deterministic_rng;
use rand_core::Rng;

let mut rng = new_deterministic_rng([1; 32]);
let mut bytes = [0u8; 32];
rng.fill_bytes(&mut bytes);