- for (let index = 0; index < n; index++)
- {
- const rand = getRandInt(index, n);
- const temp = cpArr[index];
- cpArr[index] = cpArr[rand];
- cpArr[rand] = temp;
+ for (let index = 0; index < n; index++) {
+ const rand = randInt(index, arr.length);
+ [ cpArr[index], cpArr[rand] ] = [ cpArr[rand], cpArr[index] ];