Skip to main content

rand_choose

Macro rand_choose 

Source
macro_rules! rand_choose {
    ($rng:expr, $values:expr) => { ... };
}
Expand description

Picks a random reference into the given slice (Option<&T>).

ยงExamples

use vrd::{Random, rand_choose};

let mut rng = Random::from_u64_seed(42);
let choices = [1, 2, 3];
let pick = rand_choose!(rng, &choices);