Function fill

fn fill<T: Fill + ?Sized>(dest: &mut T)

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).