Function pix_engine::math::random
source · pub fn random<T>(val: T) -> Twhere
T: Num + SampleUniform + PartialOrd,Expand description
Returns a random number between 0 and a given value.
Examples
use pix_engine::math::random;
let x = random(100); // x will range from (0..100]
assert!(x >= 0 && x < 100);
let x = random(100.0); // x will range from (0.0..100.0]
assert!(x >= 0.0 && x < 100.0);