Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. int max = individuals.size()/2;
  2. for (int i = 0; i < max; i++) {
  3. int index1 = -1;
  4. int index2 = -1;
  5. while (index1 == index2) {
  6.  
  7. index1 = random.nextInt(individuals.size());
  8. index2 = random.nextInt(individuals.size());
  9. }
  10.  
  11. Individual individual1 = individuals.remove(index1);
  12. Individual individual2 = individuals.remove(index2);
  13. //krzyżowanie
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement