Function random_bool

fn random_bool(p: f64) -> bool

Return a bool with a probability p of being true.

This function is shorthand for [rng()].random_bool(p).

Example

println!("{}", rand::random_bool(1.0 / 3.0));

Panics

If p < 0 or p > 1.