Update rand-range.md

fix incorrect usage of rng.gen_range
This commit is contained in:
codeandplay 2021-01-01 16:00:41 +00:00 committed by GitHub
parent 714e9f4fcd
commit 08e9ef16af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,8 +9,8 @@ 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));
println!("Integer: {}", rng.gen_range(0..10));
println!("Float: {}", rng.gen_range(0.0..10.0));
}
```