pub fn random_float() -> f64
Expand description
Returns a random number from 0 to 1, like Javascript Math.random
§Example
use simple_std::random_float;
let number = random_float();
println!("Number between 0 and 1: {}", number);
assert!(number < 1.0);
assert!(number >= 0.0);
§Why is this not in std?
Rust aims to be correct, that’s why it’s major random number library is cryptographically secure, meaning it’s randomness can’t easily be guessed. And cryptographically secure random number generation is a big task, that’s why it has it’s own crate.