DIPlib Documentation - ©1995-2008 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.

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 one to zero transition

EXAMPLE

Get a binary random variable as follows:

   dip_Random random;
   dip_float p10, p01, value;

   p10 = 0.1;
   p01 = 0.2;
   DIPXX( dip_BinaryRandomVariable( &random, 1, p10, p01,  &value));

SEE ALSO

RandomVariable, RandomSeed, UniformRandomVariable, GaussianRandomVariable, PoissonRandomVariable

DIPlib on-line documentation | Function reference | Global function index