DIPlib Documentation - ©1995-2017 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 typeNameDescription
dip_Random *randomPointer to a random value structure
dip_floatmeanMean of the distribution, the samples are drawn from
dip_floatvarianceVariance of the distribution, the samples are drawn from
dip_float *output1First output value
dip_float *output2Second 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