refactor UF_random_generator to fit the new std::shuffle
This commit is contained in:
parent
009ef5e1d8
commit
4ee48e760b
7 changed files with 39 additions and 29 deletions
|
|
@ -193,17 +193,19 @@ class eoInitPermutation: public eoInit<EOT> // FIXME inherit from eoInitWithDim
|
|||
virtual void operator()(EOT& chrom)
|
||||
{
|
||||
chrom.resize(chromSize);
|
||||
for(unsigned idx=0;idx <chrom.size();idx++)
|
||||
chrom[idx]=idx+startFrom;
|
||||
for(unsigned idx=0; idx < chrom.size(); idx++) {
|
||||
chrom[idx] = idx+startFrom;
|
||||
}
|
||||
|
||||
std::shuffle(chrom.begin(), chrom.end(),gen);
|
||||
UF_random_generator<unsigned int> gen(chrom.size());
|
||||
std::shuffle(chrom.begin(), chrom.end(), gen);
|
||||
chrom.invalidate();
|
||||
}
|
||||
|
||||
private :
|
||||
unsigned chromSize;
|
||||
unsigned startFrom;
|
||||
UF_random_generator<unsigned int> gen;
|
||||
// UF_random_generator<unsigned int> gen;
|
||||
};
|
||||
/** @example t-eoInitPermutation.cpp
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue