Fix off by one error inf shuffle_deck()

This commit is contained in:
flamin 2019-01-23 14:23:16 -05:00
parent 1aa7e560f1
commit 5cd663b589

View File

@ -153,8 +153,8 @@ static void shuffle_deck(struct deck *deck) {
card[i] = stack_pop(&(deck->stock));
}
srand(time(NULL));
for (int i = 0; i < NUMBER_OF_CARDS - 1; i++) {
random = i + (rand() % (NUMBER_OF_CARDS) - i);
for (int i = 0; i < NUMBER_OF_CARDS; i++) {
random = rand() % (NUMBER_OF_CARDS);
tmp = *card[i];
*card[i] = (*card[random]);
*card[random] = tmp;