Package org.jamesii.core.math.random.distributions

Examples of org.jamesii.core.math.random.distributions.BinomialDistribution


   * @param maxSize
   *          the max size
   */
  @Override
  public void mutate(double mutationRate, int minSize, int maxSize) {
    BinomialDistribution mutationNumberDistribution =
        new BinomialDistribution(getRNG(), mutationRate, length);
    int numOfMutations =
        (int) Math.round(mutationNumberDistribution.getRandomNumber());
    if (numOfMutations > genome.size()) {
      numOfMutations = genome.size();
    }
    int[] mutationPositions =
        RandomSampler.sampleUnique(numOfMutations, genome.size(), getRNG());
View Full Code Here


   *          the probability of an mutation
   *
   */
  @Override
  public void mutate(double mutationRate, int minSize, int maxSize) {
    BinomialDistribution mutationNumberDistribution =
        new BinomialDistribution(getRNG(), mutationRate, genome.length);
    int numOfMutations =
        (int) Math.round(mutationNumberDistribution.getRandomNumber());
    int[] mutationPositions =
        RandomSampler.sampleUnique(numOfMutations, genome.length, getRNG());
    for (int mutationPosition : mutationPositions) {
      genome[mutationPosition] = !genome[mutationPosition];
    }
View Full Code Here

  /** Applies test to normally distributed and binomially distributed samples. */
  public void testNormalVsBinomialSample() {
    List<Double> normalDistSample =
        getRandomSample(new NormalDistribution(random, 5.0, 2.0));
    List<Double> binomialDistSample =
        getRandomSample(new BinomialDistribution(random));
    checkTestResult(normalDistSample, binomialDistSample);
  }
View Full Code Here

TOP

Related Classes of org.jamesii.core.math.random.distributions.BinomialDistribution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.