corrected bad index error when uniform()=0 in roulette_wheel. The error was: if fortune=0, we first have "int i=0", then "return --i" .

This commit is contained in:
tlegrand 2008-02-26 14:53:32 +00:00
commit 4834adbe5f

View file

@ -263,7 +263,7 @@ public :
}
double fortune = uniform() * total;
int i = 0;
while (fortune > 0)
while (fortune >= 0)
{
fortune -= vec[i++];
}