@Test(dataProvider = "alterProbabilityParameters")
  public void alterProbability(
      final Integer ngenes, final Integer nchromosomes, final Integer npopulation, final Double p) {
    final Population<DoubleGene, Double> population =
        newDoubleGenePopulation(ngenes, nchromosomes, npopulation);

    // The mutator to test.
    final SinglePointCrossover<DoubleGene, Double> crossover = new SinglePointCrossover<>(p);

    final long nallgenes = ngenes * nchromosomes * npopulation;
    final long N = 200;
    final double mean = crossover.getOrder() * npopulation * p;

    final long min = 0;
    final long max = nallgenes;
    final Range<Long> domain = new Range<>(min, max);

    final Histogram<Long> histogram = Histogram.ofLong(min, max, 10);
    final LongMomentStatistics variance = new LongMomentStatistics();

    for (int i = 0; i < N; ++i) {
      final long alterations = crossover.alter(population, 1);
      histogram.accept(alterations);
      variance.accept(alterations);
    }

    // Normal distribution as approximation for binomial distribution.
    System.out.println(histogram);
    // TODO: Implement test
    // assertDistribution(histogram, new NormalDistribution<>(domain, mean,
    // variance.getVariance()));
  }
 private static String p(final LongMomentStatistics statistics) {
   final NumberFormat nf = NumberFormat.getIntegerInstance();
   return format(
       "max=%s; mean=%6.6f; var=%6.6f",
       nf.format(statistics.getMax()), statistics.getMean(), statistics.getVariance());
 }
 void accept(final Phenotype<?, C> pt, final long generation) {
   _age.accept(pt.getAge(generation));
 }