Skip to main content

quantaegis_core/
rng.rs

1//! Cryptographically secure random number generator abstraction.
2
3use crate::error::Result;
4
5/// Marker and interface for cryptographically secure pseudorandom number generators (CSPRNGs).
6///
7/// Implementors MUST guarantee cryptographic unpredictability (e.g., backed by OS CSPRNG such as
8/// `getrandom`). Non-cryptographic PRNGs MUST NOT implement this trait in production code.
9pub trait CryptoRng {
10    /// Fills `dest` with cryptographically secure random bytes.
11    fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<()>;
12}