DIPlib Documentation - ©1995-2009 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

dip_GaussianRandomVariable uses the algorithm, described by D.E. Knuth as the Polar Method, to generate two Gaussian distributed random variables.

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;
   DIPXX(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, UniformRandomVariable, PoissonRandomVariable, BinaryRandomVariable

DIPlib on-line documentation | Function reference | Global function index