pub fn random<T>() -> Twhere
StandardUniform: Distribution<T>,Expand description
Convenience function to generate a random value of the inferred type
This function generates a random value using the thread-local RNG. The type is inferred from context, or can be specified explicitly.
ยงExamples
use scirs2_core::random::random;
// Generate random f64
let x: f64 = random();
assert!(x >= 0.0 && x < 1.0);
// Generate random bool
let b: bool = random();
// Explicit type annotation
let y = random::<f32>();