Chromosome chromosome = new Chromosome();
int[] gene = new int[6];
gene[0] = 0;
gene[1] = (int) (1 + (Math.random() * 3));
gene[2] = (int) (4 + (Math.random() * 4));
gene[3] = (int) (8 + (Math.random() * 4));
gene[4] = (int) (12 + (Math.random() * 3));
gene[5] = 15;
chromosome.setGenes(gene);
return chromosome;
}
I have this method that inserts random numbers, and with that, I need to do another method that calculates the total distance traveled, which would be the 6 positions of the array. But I'm having trouble figuring out a way to add that distance.