DIPlib Documentation - ©1995-2015 Quantitative Imaging Group, Delft University of Technology.

# GaussianRandomVariable

Gaussian random variable generator

## SYNOPSIS

`#include "dip_noise.h"`

dip_Error dip_GaussianRandomVariable ( random, mean, variance, output1, output2 )

## FUNCTION

`GaussianRandomVariable` uses the algorithm described by D.E. Knuth as the Polar Method to generate two Gaussian distributed random variables. See `RandomVariable` for more information on the random number generator.

## ARGUMENTS

Data type | Name | Description
`dip_Random *` | `random` | Pointer to a random value structure
`dip_float` | `mean` | Mean of the distribution, the samples are drawn from
`dip_float` | `variance` | Variance of the distribution, the samples are drawn from
`dip_float *` | `output1` | First output value
`dip_float *` | `output2` | Second output value

## EXAMPLE

Get two Gaussian random variable as follows:

       dip_Random random;
       dip_float mean, variance, value1, value2;

       mean = 0.0;
       variance = 1.0;
       DIPXJ( dip_RandomSeed( &random, 0 ));
       DIPXJ( dip_GaussianRandomVariable( &random, mean, variance, &value1, &value2 ));

## LITERATURE

Knuth, D.E., Seminumerical algorithms, The art of computer programming, vol. 2, second edition Addison-Wesley, Menlo Park, California, 1981.

## SEE ALSO

`RandomVariable`, `RandomSeed`, `RandomSeedVector`, `UniformRandomVariable`, `PoissonRandomVariable`, `BinaryRandomVariable`