Implemented Fisher–Yates shuffle. Assumes RNG function is in form getNumber(min,max), with min and max inclusive (Did not find documentation on function)

This commit is contained in:
Musty Mustelidae 2014-03-08 01:23:21 -05:00 committed by Name
parent 2ad09399f4
commit 1d3667f37d

View file

@ -45,7 +45,7 @@ void Server_CardZone::shuffle()
{
for (int i = cards.size() - 1; i > 0; i--){
int j = rng->getNumber(0, i);//Assuming i is inclusive, i + 1 if exclusive (end result should be a number between 0 and i [0 and i included])
cards.swap(j,i)
cards.swap(j,i);
}
playersWithWritePermission.clear();
}