Random number generator
include "dip_noise.h"
dip_Error dip_RandomVariable ( random, value )
Generates a random number between zero and one.
This function is based on the Numerical Recipes' RAN1 function. The dip_Random structure can be initialized with the function dip_RandomSeed. If the supplied dip_Random structure is not initialized, dip_RandomVariable will initialize the dip_Random structure with a seed equal to zero. To guarantee the (psuedo) randomness between variables obtained with subsequent calls to dip_RandomVariable (or to functions that use this function to obtain a random variable), a pointer to the same dip_Random structure has to supplied when calling dip_RandomVariable.
Data type | Name | Description |
dip_Random * | random | Pointer to a random value structure |
dip_float * | value | value |
Obtain a random number as follows:
dip_Random random; dip_float val; DIPXX(dip_RandomVariable( &random, &val));
RandomSeed, UniformRandomVariable, GaussianRandomVariable, PoissonRandomVariable, BinaryRandomVariable
DIPlib on-line documentation | Function reference | Global function index