rand

Function fill

Source
pub fn fill<T: Fill + ?Sized>(dest: &mut T)
Expand description

Fill any type implementing Fill with random data

This function is shorthand for rng().fill(dest).

ยงExample

let mut arr = [0i8; 20];
rand::fill(&mut arr[..]);

Note that you can instead use random() to generate an array of random data, though this is slower for small elements (smaller than the RNG word size).