I have a set like this:
set<vector<prmNode> > cammini
I need to take 2 random values (2 random vector) from this set. How could I do?? Thank you very much!
I have a set like this:
set<vector<prmNode> > cammini
I need to take 2 random values (2 random vector) from this set. How could I do?? Thank you very much!
The simplest solution would be to do the following twice.
*(std::advance(cammini.begin(), rand() % cammini.size()))
You can do it more efficiently if you generate two indexes, advance by the smaller and then advance by the difference between them.