0

I took my deck of Cards (class Card) and shuffled the. But every time i ran the program it gave me the same shuffled results....

void Deck::shuffleDeck()
{
	std::random_shuffle(deck.begin(), deck.end());
}
3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by erikandr
0

just realizes i forgot that. Is it just

srand(time(NULL));?

EDIT: Nvm, works now. Dumb mistake by me :P ty

Edited by MasterGberry: n/a

0

Try:

void Deck::shuffleDeck()
{
        srand(time(NULL));    // Set seed for random numbers
    std::random_shuffle(deck.begin(), deck.end());
}

Cheers,
Erik

Edited by mike_2000_17: Fixed formatting

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.