Skip to main content

random_range

Macro random_range 

Source
macro_rules! random_range {
    ($rng:expr, $min:expr, $max:expr) => { ... };
}
Expand description

Generates an unbiased u32 in the half-open range [min, max).

ยงExamples

use vrd::{Random, random_range};

let mut rng = Random::from_u64_seed(42);
let n = random_range!(rng, 10, 20);
assert!(n >= 10 && n < 20);