Fixed bug in rng::roulette_wheel: use of float had too little precision in change/fortune var

This commit is contained in:
maartenkeijzer 2004-03-26 09:56:56 +00:00
commit 4bdccb3dae

View file

@ -224,15 +224,14 @@ public :
total += vec[i];
}
float change = uniform() * total;
double fortune = uniform() * total;
int i = 0;
while (change > 0)
while (fortune > 0)
{
change -= vec[i++];
fortune -= vec[i++];
}
return --i;
}