Skip to main content

random_bytes

Function random_bytes 

Source
pub fn random_bytes(len: usize) -> Result<Vec<u8>>
Available on crate feature tier3 only.
Expand description

Return a Vec<u8> of cryptographically secure random bytes.

Convenience for callers who don’t already have a buffer.

§Example

use mod_rand::tier3;

let bytes = tier3::random_bytes(32).unwrap();
assert_eq!(bytes.len(), 32);