Insert
Code:
srand( (unsigned)time( NULL ) );
in the Shuffle method, between "int k" and the "for" loop.
Code:
void BlackJack::Shuffle(vector<pair<int,int> > cards)
{
pair<int, int> temp;
int k;
srand( (unsigned)time( NULL ) );
for (unsigned int i = 0; i < cards.size(); ++i)
{
k=(rand() % 52);
temp = cards[i];
cards[i] = cards[k];
cards[k] = temp;
// A simple but ugly test. Friends are "helping" me (not)
//so I need to go soon :(.
cout<<cards[i].first<<"_"<<cards[i].second<<endl;
}
} Since we are working in std c++, add the <ctime> header on top.
Not <time.h> but <ctime> . If you read a few topics in this forum you will know why.
The "c" word without the ".h" extension is the new standard C++ of adding an 'old' C-based library.