Added the shuffle method
This commit is contained in:
parent
deace62e55
commit
c62521648b
1 changed files with 10 additions and 0 deletions
|
|
@ -132,6 +132,16 @@ class eoPop: public vector<EOT>, public eoObject, public eoPersistent
|
||||||
std::sort(begin(), end(), greater<EOT>());
|
std::sort(begin(), end(), greater<EOT>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
shuffle the population. Use this member to put the population
|
||||||
|
in random order
|
||||||
|
*/
|
||||||
|
void shuffle(void)
|
||||||
|
{
|
||||||
|
UF_random_generator<unsigned int> gen;
|
||||||
|
std::random_shuffle(begin(), end(), gen);
|
||||||
|
}
|
||||||
|
|
||||||
// creates a vector<EOT*> pointing to the individuals in descending order
|
// creates a vector<EOT*> pointing to the individuals in descending order
|
||||||
void sort(vector<const EOT*>& result) const
|
void sort(vector<const EOT*>& result) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Reference in a new issue