I need to seed a random function with a seed 2222. The shuffleDeck() function calls random_shuffle from the std library.
Note: The problem is, every time I run the program with no_deals=5, and cards_per_hand=5, I get the same pattern:
Jack of Spades, King of Diamonds, 10 of Hearts, 4 of Clubs, King of Spades, 8 of Diamonds, 3 of Diamonds, 3 of Diamonds, 7 of Hearts, 5 of Clubs, 3 of Hearts, 10 of Hearts, 6 of Diamonds, King of Spades, Jack of Diamonds, 7 of Hearts, 3 of Diamonds, King of Diamonds, Jack of Hearts, 3 of Diamonds,
Shouldn't there be a change? Am I inputting the seed 2222 correctly?
srand(2222);
for (int i=0; i<no_deals; i++)
{
// test.shuffleDeck();
for(int j=0; j<cards_per_hand; j++)
{
//test.dealCard();
check.at(j)=test.dealCard();
cout<<check.at(j)<<", ";
test.shuffleDeck();
}
cout<<endl;
}
Aucun commentaire:
Enregistrer un commentaire