I'm making a card game and I dont want the same card to be dealt in any one hand. I tried this function but it doesnt seem to work:
function pickcard () {
x = random (52);
if (cardpicked [x] == false) {
cardpicked [x] = true;
return (x);
}
else {
pickcard ();
}
}
Is there a way to randomise a whole array, so i could have an array with 52 elements that is randomised?
Thanks,
Jon
function pickcard () {
x = random (52);
if (cardpicked [x] == false) {
cardpicked [x] = true;
return (x);
}
else {
pickcard ();
}
}
Is there a way to randomise a whole array, so i could have an array with 52 elements that is randomised?
Thanks,
Jon