Update rand to 0.8 and rand_distr to 0.4

This commit is contained in:
Joakim Frostegård 2020-12-19 11:24:52 +01:00
parent de3042bf4a
commit e1260d14de
12 changed files with 89 additions and 54 deletions

View file

@ -12,4 +12,4 @@ name = "aquatic_common"
[dependencies]
indexmap = "1"
rand = { version = "0.7", features = ["small_rng"] }
rand = { version = "0.8", features = ["small_rng"] }

View file

@ -57,12 +57,10 @@ pub fn extract_response_peers<K, V, R, F>(
let half_peer_map_len = peer_map_len / 2;
let offset_first_half = rng.gen_range(
0,
(half_peer_map_len + (peer_map_len % 2)) - half_num_to_take
0..(half_peer_map_len + (peer_map_len % 2)) - half_num_to_take
);
let offset_second_half = rng.gen_range(
half_peer_map_len,
peer_map_len - half_num_to_take
half_peer_map_len..peer_map_len - half_num_to_take
);
let end_first_half = offset_first_half + half_num_to_take;