shell bypass 403
/**
* Fisher-Yates shuffle ES6 non-mutating implementation.
* @param {Array} array the array to shuffle
* @return {Array} shuffled array without mutating the initial array.
*/
export const shuffle = (array: any[]): any[] => {
// perform deep clone on array to mutate
let cloned = array.slice(0);
// array to return
let randomizedArray = [];
// perform shuffle
while (cloned.length !== 0) {
let rIndex = Math.floor(cloned.length * Math.random());
randomizedArray.push(cloned[rIndex]);
cloned.splice(rIndex, 1);
}
return randomizedArray;
};