mirror of
https://github.com/rust-lang-nursery/rust-cookbook
synced 2024-11-24 20:43:07 +00:00
Update rand-range.md
fix incorrect usage of rng.gen_range
This commit is contained in:
parent
714e9f4fcd
commit
08e9ef16af
1 changed files with 2 additions and 2 deletions
|
@ -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));
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue