removed unnecessary call to saturated_sub() in vec_shuffle

This commit is contained in:
mjkeating 2018-11-23 19:29:03 -08:00
parent 7995200903
commit d6bf1a6119

View File

@ -29,7 +29,7 @@ pub fn shuffle<T>(seed: &[u8], mut list: Vec<T>) -> Result<Vec<T>, ShuffleErr> {
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 j = rng.rand_range(n as u32) as usize + i;
list.swap(i, j);