Gaussian random variable generator
#include "dip_noise.h"
dip_Error dip_GaussianRandomVariable ( random, mean, variance, output1, output2 )
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.
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 |
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 ));
Knuth, D.E., Seminumerical algorithms, The art of computer programming, vol. 2, second edition Addison-Wesley, Menlo Park, California, 1981.
RandomVariable, RandomSeed, RandomSeedVector, UniformRandomVariable, PoissonRandomVariable, BinaryRandomVariable