public ArrayList<Integer> mutate(ArrayList<Integer> genome){
  ArrayList<Integer> result=new ArrayList<Integer>(this.genomeLength);
  for (  Integer integer : genome) {
    result.add(integer);
  }
  for (int i=0; i < numberOfMutationsToMutant; i++) {
    ArrayList<Integer> strip=permutator.permutate(genomeLength);
    int pos1=strip.get(0) - 1;
    int pos2=strip.get(1) - 1;
    Collections.swap(result,pos1,pos2);
  }
  return result;
}

public ArrayList < Integer > mutate ( ArrayList < Integer > genome ) { ArrayList < Integer > result = new ArrayList < Integer > ( this . genomeLength ) ; for ( Integer integer : genome ) { result . add ( integer ) ; } for ( int i = 0 ; i < numberOfMutationsToMutant ; i ++ ) { ArrayList < Integer > strip = permutator . permutate ( genomeLength ) ; int pos1 = strip . get ( 0 ) - 1 ; int pos2 = strip . get ( 1 ) - 1 ; Collections . swap ( result , pos1 , pos2 ) ; } return result ; }
the method receives a genome ; randomly selects two positions in the genome ; and swaps the two objects ( alleles ) in those positions .
