Function get_random_bytes

Source
pub fn get_random_bytes<const N: usize>(rng: &mut impl CryptoRngCore) -> [u8; N]
Expand description

Generates a random byte array of the given length.

ยงExamples

use rand::thread_rng;
use wnfs_common::utils;

let rng = &mut thread_rng();
let bytes = utils::get_random_bytes::<32>(rng);

assert_eq!(bytes.len(), 32);