removed unnecessary call to saturated_sub() in vec_shuffle
This commit is contained in:
parent
7995200903
commit
d6bf1a6119
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user