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

# PoissonRandomVariable

Poisson random variable generator

## SYNOPSIS

`#include "dip_noise.h"`

dip_Error dip_PoissonRandomVariable ( random, mean, value )

## FUNCTION

`PoissonRandomVariable` uses the algorithm as described in "Numerical Recipes in C, 2nd edition", section 7.3. For values of `mean` larger or equal to 32 the rejection method is used.

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 value for the distribution
`dip_float *` | `value` | Poisson distributed output value

## EXAMPLE

Get a Poisson random variable as follows:

       dip_Random random;
       dip_float mean, value;

       mean = 23.0;
       DIPXJ( dip_RandomSeed( &random, 0 ));
       DIPXJ( dip_PoissonRandomVariable( &random, mean, &value ));

## LITERATURE

Press, W.H., Teukolsky, S.A., Vetterling, W.T., and Flannery, B.P. Numerical Recipes in C, 2nd edition, Cambridge University Press, Cambridge, 1992.

## SEE ALSO

`RandomVariable`, `RandomSeed`, `RandomSeedVector`, `UniformRandomVariable`, `GaussianRandomVariable`, `BinaryRandomVariable`