Replaced unnecessary custom shuffle methods with std::random_shuffle<>.

This commit is contained in:
wrenczes@gmail.com
2011-02-05 06:25:25 +00:00
parent f6bef26243
commit a0a3c59b29
2 changed files with 2 additions and 32 deletions

View File

@@ -284,30 +284,7 @@ bool WSrcCards::setOffset(int pos)
void WSrcCards::Shuffle()
{
vector<MTGCard*> a;
MTGCard * temp;
vector<MTGCard*>::iterator k;
while (cards.size())
{
k = cards.begin();
k += rand() % cards.size();
temp = *k;
cards.erase(k);
a.push_back(temp);
}
#if defined WIN32 || defined LINUX //PC performs a double shuffle for less streaking.
while(a.size())
{
k = a.begin();
k += rand() % a.size();
temp = *k;
a.erase(k);
cards.push_back(temp);
}
#else //PSP does a straight swap for speed.
cards.swap(a);
#endif
std::random_shuffle(cards.begin(), cards.end());
validate();
}