diff --git a/eo/src/eoStochasticUniversalSelect.h b/eo/src/eoStochasticUniversalSelect.h index d9ec16ef..ac64f149 100755 --- a/eo/src/eoStochasticUniversalSelect.h +++ b/eo/src/eoStochasticUniversalSelect.h @@ -31,6 +31,8 @@ #include #include +#include +#include //----------------------------------------------------------------------------- /** eoStochasticUniversalSelect: select an individual proportional to her stored fitness @@ -80,6 +82,11 @@ public: i = 0; } } + // shuffle + for (int i = indices.size() - 1; i > 0; --i) { + int j = rng.random(i+1); + swap(indices[i], indices[j]); + } } /** do the selection,