diff --git a/mo/src/neighborhood/moRndVectorVNSelection.h b/mo/src/neighborhood/moRndVectorVNSelection.h index af4ab22dd..86a9d00b7 100644 --- a/mo/src/neighborhood/moRndVectorVNSelection.h +++ b/mo/src/neighborhood/moRndVectorVNSelection.h @@ -52,7 +52,7 @@ class moRndVectorVNSelection: public moVectorVNSelection /** * Default constructor with first search heuristics * - * @param _firstLS first local search + * @param _firstLS first local search * @param _firstShake first heuristic which perturbs the solution * @param _cycle when true, the first heuristics follows the last ones. Otherwise the search stop. */ @@ -67,7 +67,7 @@ class moRndVectorVNSelection: public moVectorVNSelection } /** - * test if there is still some heuristics + * test if there is still some heuristics * * @param _solution the current solution * @return true if there is some heuristics @@ -83,11 +83,17 @@ class moRndVectorVNSelection: public moVectorVNSelection */ virtual void init(EOT& /*_solution*/) { if(order.size() == 0) - for(unsigned int i = 0; i < LSvector.size(); i++) - order.push_back(i); - + for(unsigned int i = 0; i < LSvector.size(); i++) { + order.push_back(i); } + +#if __cplusplus >= 201103L + std::random_device rd; + std::mt19937 gen(rd()); + std::shuffle(order.begin(), order.end(), gen); +#else UF_random_generator gen(order.size()); std::random_shuffle(order.begin(), order.end(), gen); +#endif currentOrder = 0; current = order[currentOrder];