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
|
|
@ -71,10 +71,10 @@ class moeoDetArchiveSelect : public eoSelect<MOEOT>
|
|||
_dest.push_back(archive[i]);
|
||||
}
|
||||
else if (archive_size > max){
|
||||
UF_random_generator<unsigned int> rndGen;
|
||||
std::vector <int> permutation;
|
||||
for(unsigned int i=0; i < archive_size; i++)
|
||||
permutation.push_back(i);
|
||||
UF_random_generator<unsigned int> rndGen(permutation.size());
|
||||
random_shuffle(permutation.begin(), permutation.end(), rndGen);
|
||||
for (unsigned int i=0; i<max; i++)
|
||||
_dest.push_back(archive[permutation[i]]);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public:
|
|||
res.push_back(i);
|
||||
}
|
||||
if(number < res.size()){
|
||||
UF_random_generator<unsigned int> rndGen;
|
||||
UF_random_generator<unsigned int> rndGen(res.size());
|
||||
std::random_shuffle(res.begin(), res.end(), rndGen);
|
||||
res.resize(number);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue