code: @Override
      public double[] buildNextGenes() {
          double[] result;
  
          boolean hasAlreadyBeenTried;
          int attemptsRemaining = MAX_NUM_GENERATION_ATTEMPTS;
          do {
              if (populationModel.isReadyToBreed()) {
                  result = buildOffspring();
              } else {
                  result = buildRandomGenes();
              }
  
              hasAlreadyBeenTried = hasAlreadyBeenTried(result);
              if (hasAlreadyBeenTried && --attemptsRemaining == 0) {
                  throw new GeneticGenerationException("Failed to generate a set of genes not already tried.");
              }
          } while (hasAlreadyBeenTried);
  
          previousGenes[previousGenesIdx] = result;
          previousGenesIdx = ++previousGenesIdx % previousGenes.length;
  
          return result;
      }
docs: Build a new set of genes. Has two distinct modes of operation
  <ul>
  <li>Before the population has reached the culled size: will return a random set of genes.</li>
  <li>After: Parents will be selected among the population, a crossover will be applied followed by a mutation.</li>
  </ul>
  @return Returns the generated set of genes
  @throws GeneticGenerationException If buildNextGenes() can't generate a set that has not already been tried,
  or if the crossover and the mutation operators can't generate a set,
  this exception is thrown.