I have this code:
function shuffle(array) {
var counter = array.length, temp, index;
// While there are elements in the array
while (counter > 0) {
// Pick a random index
index = Math.floor(Math.random() * counter);
// Decrease counter by 1
counter--;
// And swap the last element with it
temp = array[counter];
array[counter] = array[index];
array[index] = temp;
}
return array;
}
And then I have this:
function somethingOne(){
shuffle(array);
...
}
My goal is to create a somethingTwo()
function that uses the array that was shuffled in the somethingOne()
function, how can I do this?