Answers for "random from 0 to 1 rust"

0

rust random float between 0 and 1

use rand::Rng; // 0.8.0

fn main() {
    // Generate random number in the range [0, 99]
    let num = rand::thread_rng().gen_range(0..100);
    println!("{}", num);
}
Posted by: Guest on February-24-2021

Browse Popular Code Answers by Language