Skip to main content

rand_bool

Macro rand_bool 

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

Generates a random bool whose probability of true is the second argument. Panics if the probability is outside [0.0, 1.0].

ยงExamples

use vrd::{Random, rand_bool};

let mut rng = Random::from_u64_seed(42);
let b = rand_bool!(rng, 0.5);