#include #include #include using std::pair; using std::vector; class myParentsChooser { public: // A constructor takes all locations of male and female. myParentsChooser(const std::vector & m, const std::vector & f) : male_idx(m), female_idx(f) { srand(time(0)); } pair chooseParents() { unsigned long male = rand() % male_idx.size(); unsigned long female = rand() % male_idx.size(); return std::make_pair(male, female); } private: vector male_idx; vector female_idx; };