is it possible to time the execution of a method ?
in
Programming Questions
•
9 months ago
hi there i am making a card game and have this shuffle method which i call after a hand is played , i was just wondering if it is possible to time the execution of the method as sometimes the next hand is starting but the cards aren't displayed properly i am sure this is because the shuffle hasnt finished , i have added a delay(3000) to the draw loop thought this would be enough but sometimes it isnt cheers for any advice
void shuffle() {
for (int i=0; i < deck.length; i++) {
int randomPosition = (int)random(0, 51);
Card temp = deck[i];
deck[i] = deck[randomPosition];
deck[randomPosition] = temp;
}
}
void shuffle() {
for (int i=0; i < deck.length; i++) {
int randomPosition = (int)random(0, 51);
Card temp = deck[i];
deck[i] = deck[randomPosition];
deck[randomPosition] = temp;
}
}
1