Binary random variable generator
#include "dip_noise.h"
dip_Error dip_BinaryRandomVariable ( random, input, p10, p01, output )
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.
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 |
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));
RandomVariable, RandomSeed, UniformRandomVariable, GaussianRandomVariable, PoissonRandomVariable
DIPlib on-line documentation | Function reference | Global function index