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

BinaryRandomVariable

Binary random variable generator

SYNOPSIS

#include "dip_noise.h"

dip_Error dip_BinaryRandomVariable ( random, input, p10, p01, output )

FUNCTION

The binary random variable is generated by altering the input value, if the value of a generated random variable is higher than the p10 probability, if input is DIP_TRUE, or higher than p01 otherwise.

See RandomVariable for more information on the random number generator.

ARGUMENTS

Data typeNameDescription
dip_Random *randomPointer to a random value structure
dip_BooleaninputInput
dip_floatp10Probability of a one to zero transition
dip_floatp01Probability of a zero to one transition

EXAMPLE

Get a binary random variable as follows:

   dip_Random random;
   dip_float p10, p01, value;

   p10 = 0.1;
   p01 = 0.2;
   DIPXJ( dip_RandomSeed( &random, 0 ));
   DIPXJ( dip_BinaryRandomVariable( &random, 1, p10, p01,  &value ));

SEE ALSO

RandomVariable, RandomSeed, RandomSeedVector, UniformRandomVariable, GaussianRandomVariable, PoissonRandomVariable