Gaussian random variable generator
#include "dip_noise.h"
dip_Error dip_GaussianRandomVariable ( random, mean, variance, output1, output2 )
dip_GaussianRandomVariable uses the algorithm, described by D.E. Knuth as the Polar Method, to generate two Gaussian distributed random variables.
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; DIPXX(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, UniformRandomVariable, PoissonRandomVariable, BinaryRandomVariable
DIPlib on-line documentation | Function reference | Global function index