Skip to content

Commit

Permalink
Updated rand_distr, fixed and updated rand. (rust-lang-nursery#627)
Browse files Browse the repository at this point in the history
The `rand` crate has been updated to version `0.8.0`, and has its code
samples updated.

The `rand_distr` crate has been updated to version `0.4.0`.
  • Loading branch information
myrkvi authored Jan 1, 2021
1 parent 714e9f4 commit 8d0d2e3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ num_cpus = "1.8"
percent-encoding = "2.1"
petgraph = "0.4"
postgres = "0.17.2"
rand = "0.7.3"
rand_distr = "0.2.2"
rand = "0.8.0"
rand_distr = "0.4.0"
rayon = "1.0"
regex = "1.0"
reqwest = { version = "0.10", features = ["blocking", "json", "stream"] }
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/randomness/rand-choose.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn main() {
let password: String = (0..PASSWORD_LEN)
.map(|_| {
let idx = rng.gen_range(0, CHARSET.len());
let idx = rng.gen_range(0..CHARSET.len());
CHARSET[idx] as char
})
.collect();
Expand Down
1 change: 1 addition & 0 deletions src/algorithms/randomness/rand-passwd.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fn main() {
let rand_string: String = thread_rng()
.sample_iter(&Alphanumeric)
.take(30)
.map(char::from)
.collect();
println!("{}", rand_string);
Expand Down
4 changes: 2 additions & 2 deletions src/algorithms/randomness/rand-range.md
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
```

Expand Down

0 comments on commit 8d0d2e3

Please sign in to comment.