📜  rust lang rand between - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:08.452000             🧑  作者: Mango

代码示例1
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));
}