Java Utililty Methods Gaussian

List of utility methods to do Gaussian

Description

The list of methods to do Gaussian are organized into topic(s).

Method

double[][]addGaussianNoise(double[][] d, double m, double v)
Matlab compatible see code of imnoise in Matlab
double[][] r = new double[d.length][d[0].length];
Random rnd = new Random();
for (int i = 0; i < d.length; i++) {
    for (int j = 0; j < d[0].length; j++) {
        r[i][j] = Math.round(m + d[i][j] + rnd.nextGaussian() * Math.sqrt(v));
return r;
...
doublegaussian()
Returns a real number with a standard Gaussian distribution.
double r, x, y;
do {
    x = uniform(-1.0, 1.0);
    y = uniform(-1.0, 1.0);
    r = x * x + y * y;
} while (r >= 1 || r == 0);
return x * Math.sqrt(-2 * Math.log(r) / r);
doublegetGaussian()
get Gaussian
return random.nextGaussian();
doublegetGaussian(double aMean, double aVariance)
get Gaussian
return aMean + fRandom.nextGaussian() * aVariance;
doublehashToGaussian(int h)
hash To Gaussian
Random random = new Random(h);
for (int i = 0; i < 5; i++) {
    random.nextGaussian();
    random.nextGaussian();
    random.nextGaussian();
    random.nextGaussian();
    random.nextGaussian();
return random.nextGaussian();
doubleRandGaussian()
Rand Gaussian
return RandGaussian(0, 1);