/** * Generate a random value from a Normal (a.k.a. Gaussian) distribution with the given mean, * <code>mu</code> and the given standard deviation, <code>sigma</code>. * * @param mu the mean of the distribution * @param sigma the standard deviation of the distribution * @return the random Normal value */ public double nextGaussian(double mu, double sigma) { if (sigma <= 0) { throw new IllegalArgumentException("Gaussian std dev must be > 0"); } RandomGenerator rand = getRan(); return sigma * rand.nextGaussian() + mu; }
/** * Generate a random scalar with null mean and unit standard deviation. * * @return a random scalar with null mean and unit standard deviation */ public double nextNormalizedDouble() { return generator.nextGaussian(); }