/** * Makes the array a have unique elements. * WARNING: WILL ALTER THE ARRAY GIVEN * @param a */ function arrayUnique(a : Array) { for(var i=0; i) { a = a.slice(); arrayUnique(a); return a; } function arrayShuffle (a : Array) { for (let i = 0; i < a.length; i++) { let pos = Math.floor(Math.random() * (a.length - i)) + i; let temp = a[i]; a[i] = a[pos]; a[pos] = temp; } } function arrayShuffleNewArray (a : Array) { let nA = a.slice(); arrayShuffle(nA); return nA; }