From 4834adbe5f03e5f324b750f1f869e2f1bf9b09e0 Mon Sep 17 00:00:00 2001 From: tlegrand Date: Tue, 26 Feb 2008 14:53:32 +0000 Subject: [PATCH] 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" . --- eo/src/utils/eoRNG.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo/src/utils/eoRNG.h b/eo/src/utils/eoRNG.h index 8dbb4321..c9d16ac8 100644 --- a/eo/src/utils/eoRNG.h +++ b/eo/src/utils/eoRNG.h @@ -263,7 +263,7 @@ public : } double fortune = uniform() * total; int i = 0; - while (fortune > 0) + while (fortune >= 0) { fortune -= vec[i++]; }