Skip to main content

new_secure_rng

Function new_secure_rng 

Source
pub fn new_secure_rng() -> Result<LibQRng>
Expand description

Create a new secure RNG instance

This function creates a cryptographically secure RNG using the best available entropy source for the current platform.

§Errors

Returns an error if no secure entropy source is available.

§Examples

use lib_q_random::new_secure_rng;
use rand_core::Rng;

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