DIPlib Documentation - ©1995-2009 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 type | Name | Description
`dip_Random *` | `random` | Pointer to a random value structure
`dip_Boolean` | `input` | Input
`dip_float` | `p10` | Probability of a one to zero transition
`dip_float` | `p01` | Probability 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