@ Override protected List < Point > mutateVertices ( List < Point > vertices , Random rng ) { // A single point is added with the configured probability, unless // we already have the maximum permitted number of points. if ( vertices . size ( ) < MAX_VERTEX_COUNT && getMutationProbability ( ) . nextValue ( ) . nextEvent ( rng ) ) { List < Point > newVertices = new ArrayList < Point > ( vertices ) ; newVertices . add ( rng . nextInt ( newVertices . size ( ) ) , new Point ( rng . nextInt ( getCanvasSize ( ) . width ) , rng . nextInt ( getCanvasSize ( ) . height ) ) ) ; return newVertices ; } else // Nothing changed. { return vertices ; } }
Mutates the list of vertices for a given polygon by adding a new random point . Whether or not a point is actually added is determined by the configured mutation probability .