2019-05-15 01:25:46 +03:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
export function shuffled(array: Array<any>): Array<any> {
|
|
|
|
array = array.slice();
|
|
|
|
|
|
|
|
for (let i = array.length - 1; i > 0; i--) {
|
2019-11-01 17:33:51 +03:00
|
|
|
const j = Math.floor(Math.random() * (i + 1));
|
|
|
|
const tmp = array[i];
|
2019-05-15 01:25:46 +03:00
|
|
|
array[i] = array[j];
|
|
|
|
array[j] = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
return array;
|
|
|
|
}
|