Example usage for org.apache.commons.math3.distribution UniformRealDistribution UniformRealDistribution

List of usage examples for org.apache.commons.math3.distribution UniformRealDistribution UniformRealDistribution

Introduction

In this page you can find the example usage for org.apache.commons.math3.distribution UniformRealDistribution UniformRealDistribution.

Prototype

public UniformRealDistribution(double lower, double upper, double inverseCumAccuracy)
        throws NumberIsTooLargeException 

Source Link

Document

Create a uniform distribution.

Usage

From source file:com.anhth12.distributions.Distributions.java

public static RealDistribution uniform(RandomGenerator rng, double fanIn) {
    fanIn = Math.abs(fanIn);/*from  w  w w .j  av  a 2  s. c  o m*/
    if (uniformDist.get(rng, fanIn) == null) {
        RealDistribution ret = new UniformRealDistribution(rng, -fanIn, fanIn);
        uniformDist.put(rng, fanIn, ret);
        return ret;
    }

    return uniformDist.get(rng, fanIn);
}

From source file:com.anhth12.distributions.Distributions.java

public static RealDistribution uniform(RandomGenerator rng, double min, double max) {
    return new UniformRealDistribution(rng, min, max);
}

From source file:com.anhth12.distributions.Distributions.java

public static RealDistribution uniform(RandomGenerator rng) {
    double fanIn = 0.1;
    return new UniformRealDistribution(rng, -fanIn, fanIn);
}

From source file:com.vsthost.rnd.jdeoptim.evolution.strategies.SimpleStrategy.java

public SimpleStrategy(double cr, double f, RandomGenerator randomGenerator) {
    // Save the random number generator:
    this.randomGenerator = randomGenerator;

    // Save the CR and F parameters:
    this.cr = cr;
    this.f = f;/*from   w w  w.j  a va 2s  . c om*/

    // Setup the distribution for random sampling of members:
    this.probability = new UniformRealDistribution(randomGenerator, 0, 1);
}

From source file:fr.ign.cogit.simplu3d.rjmcmc.generic.sampler.GreenSamplerBlockTemperature.java

public GreenSamplerBlockTemperature(RandomGenerator rng, DirectSampler<O, C, M> d,
        Acceptance<? extends Temperature> a, List<Kernel<C, M>> k) {
    this.density = d;
    this.acceptance = a;
    this.kernels = k;
    this.die = new UniformRealDistribution(rng, 0, 1);
}

From source file:es.csic.iiia.planes.util.MultivariateUniformDistribution.java

public MultivariateUniformDistribution(double[] lowers, double[] uppers) {
    super(new Well19937c(), lowers.length);
    final int n_vars = getDimension();

    if (uppers.length != n_vars) {
        throw new DimensionMismatchException(uppers.length, n_vars);
    }/* w  ww. j av a  2  s.c  o  m*/

    distributions = new UniformRealDistribution[n_vars];
    for (int i = 0; i < n_vars; i++) {
        distributions[i] = new UniformRealDistribution(random, lowers[i], uppers[i]);
    }
}

From source file:com.vsthost.rnd.jdeoptim.evolution.strategies.SandboxStrategy.java

public SandboxStrategy(double cr, double f, double c, RandomGenerator randomGenerator) {
    // Save the random number generator:
    this.randomGenerator = randomGenerator;

    // Save the CR, F and c parameters:
    this.cr = cr;
    this.f = f;/*from  w w w  .j a  v  a 2s.c o m*/
    this.c = c;

    // Set the meanCR initially to the crossover:
    this.meanCR = this.cr;

    // Set the meanF initially to the crossover:
    this.meanF = this.f;

    // Setup the distribution for random sampling of members:
    this.probability = new UniformRealDistribution(randomGenerator, 0, 1);
}

From source file:com.vsthost.rnd.jdeoptim.evolution.strategies.Strategy3.java

/**
 * Implements the Strategy 3./*from   w w w .  j a  v a  2  s.c  o m*/
 *
 * @param cr Crossover probability
 * @param f Weighting factor.
 * @param c Speed of CR adaptation.
 * @param jitterFactor The jitter factor
 * @param bounceBack Indicates if we are bouncing back or setting to limits in case of violations.
 * @param randomGenerator The random generator.
 */
public Strategy3(double cr, double f, double c, double jitterFactor, boolean bounceBack, double precision,
        RandomGenerator randomGenerator) {
    // Save the random number generator:
    this.randomGenerator = randomGenerator;

    // Save the CR, F and c parameters:
    this.cr = cr;
    this.f = f;
    this.c = c;

    // Save the jitter factor:
    this.jitterFactor = jitterFactor;

    // Save the bounce back param:
    this.bounceBack = bounceBack;

    // Set the meanCR initially to the crossover:
    this.meanCR = this.cr;

    // Set the meanF initially to the crossover:
    this.meanF = this.f;

    // Save precision:
    this.precision = precision;

    // Setup the distribution for random sampling of members:
    this.probability = new UniformRealDistribution(randomGenerator, 0, 1);
}

From source file:edu.cmu.tetrad.util.RandomUtil.java

/**
 * /* w  w  w.j  a v a 2s .com*/
 * Returns a random double from U(low, high).
 *
 * @param low  Ibid.
 * @param high Ibid.
 * @return Ibid.
 */
public double nextUniform(double low, double high) {
    return new UniformRealDistribution(randomGenerator, low, high).sample();
}

From source file:com.github.rinde.rinsim.util.StochasticSuppliers.java

/**
 * Creates a {@link StochasticSupplier} that produces uniformly distributed
 * {@link Double}s./*  w ww .  j a v  a 2 s .co  m*/
 * @param lower The (inclusive) lower bound of the uniform distribution.
 * @param upper The (inclusive) upper bound of the uniform distribution.
 * @return The supplier.
 */
public static StochasticSupplier<Double> uniformDouble(double lower, double upper) {
    return new DoubleDistributionSS(new UniformRealDistribution(new MersenneTwister(), lower, upper));
}