Function random

Source
pub fn random<T>(val: T) -> T
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);