Function nannou::rand::random_range
source · pub fn random_range<T>(min: T, max: T) -> Twhere
T: PartialOrd + SampleUniform,
Expand description
A function for generating a random value within the given range.
The generated value may be within the range [min, max). That is, the result is inclusive of
min
, but will never be max
.
If the given min
is greater than the given max
, they will be swapped before calling
gen_range
internally to avoid triggering a panic!
.
This calls rand::thread_rng().gen_range(min..max)
internally, in turn using the thread-local
default random number generator.
NOTE: This helper function relies on a thread-local RNG and is currently only available with the “std” feature enabled.