📅  最后修改于: 2022-03-11 14:49:25.129000             🧑  作者: Mango
use rand::Rng;
fn main() {
let mut rng = rand::thread_rng();
let n1: u8 = rng.gen();
println!("Random u8: {}", n1);
println!("Random u32: {}", rng.gen::());
//print with range[1 to 4]
let n2: u8 = rand::thread_rng().gen_range(1..5);
}