/** * @param mean The mean of the resulting distribution. * @param standardDeviation The standard deviation of the distribution. * @param randomGenerator The random number generator to use. This can be null if you don't * need to generate any numbers. */ public Normal(double mean, double standardDeviation, Random randomGenerator) { setRandomGenerator(randomGenerator); setState(mean, standardDeviation); }
@Test public void consistency() { Random gen = RandomUtils.getRandom(); double offset = 0; double scale = 1; Normal dist = new Normal(offset, scale, RandomUtils.getRandom()); for (int k = 0; k < 20; k++) { dist.setState(offset, scale); DistributionChecks.checkDistribution(dist, breaks, offset, scale, 10000); offset = gen.nextGaussian(); scale = Math.exp(3 * gen.nextGaussian()); } }
@Test public void testSetState() throws Exception { Normal dist = new Normal(0, 1, RandomUtils.getRandom()); dist.setState(1.3, 5.9); DistributionChecks.checkDistribution(dist, breaks, 1.3, 5.9, 10000); }
/** * @param mean The mean of the resulting distribution. * @param standardDeviation The standard deviation of the distribution. * @param randomGenerator The random number generator to use. This can be null if you don't * need to generate any numbers. */ public Normal(double mean, double standardDeviation, Random randomGenerator) { setRandomGenerator(randomGenerator); setState(mean, standardDeviation); }
/** * @param mean The mean of the resulting distribution. * @param standardDeviation The standard deviation of the distribution. * @param randomGenerator The random number generator to use. This can be null if you don't * need to generate any numbers. */ public Normal(double mean, double standardDeviation, Random randomGenerator) { setRandomGenerator(randomGenerator); setState(mean, standardDeviation); }
@Test public void consistency() throws Exception { Random gen = RandomUtils.getRandom(); double offset = 0; double scale = 1; Normal dist = new Normal(offset, scale, RandomUtils.getRandom()); for (int k = 0; k < 20; k++) { dist.setState(offset, scale); DistributionChecks.checkDistribution(dist, breaks, offset, scale, 10000); offset = gen.nextGaussian(); scale = Math.exp(3 * gen.nextGaussian()); } }
@Test public void testSetState() throws Exception { Normal dist = new Normal(0, 1, RandomUtils.getRandom()); dist.setState(1.3, 5.9); DistributionChecks.checkDistribution(dist, breaks, 1.3, 5.9, 10000); }