Answers for "rust lang rand between"

0

rust lang rand between

use rand::Rng;

fn main() {
    let mut rng = rand::thread_rng();
    println!("Integer: {}", rng.gen_range(0..10));
    println!("Float: {}", rng.gen_range(0.0..10.0));
}
Posted by: Guest on July-02-2021

Browse Popular Code Answers by Language