Merge pull request #72 from mjkeating/remove_saturated_sub
removed unnecessary call to saturated_sub() in vec_shuffle
This commit is contained in:
commit
ba548e49a5
@ -29,7 +29,7 @@ pub fn shuffle<T>(seed: &[u8], mut list: Vec<T>) -> Result<Vec<T>, ShuffleErr> {
|
|||||||
return Ok(list);
|
return Ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in 0..(list.len().saturating_sub(1)) {
|
for i in 0..(list.len() - 1) {
|
||||||
let n = list.len() - i;
|
let n = list.len() - i;
|
||||||
let j = rng.rand_range(n as u32) as usize + i;
|
let j = rng.rand_range(n as u32) as usize + i;
|
||||||
list.swap(i, j);
|
list.swap(i, j);
|
||||||
|
Loading…
Reference in New Issue
Block a user