0
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 function somethingTwo()
which uses the array that has been shuffled in the function somethingOne()
, how can I do this?
But what do you want to do in this function? Where the function will be called?
– Maniero
I have a deck of cards, where the array is the 52 images... I in somethingOne() deck the cards, and deliver 13 cards to each "player" ... What I wanted was a function for example somethingTwo() sort each player’s "hand", that is, sort each player’s cards... You know what I mean?
– ElHashashin
And for that I need to access the cards that were shuffled in somethingOne function()
– ElHashashin