 A random variable X is Bernoulli-distributed with parameter p if it has two possible outcomes usually encoded 1 (success or default) or 0 (failure or survival) where the probabilities of success and failure are formula_1 and formula_2 where formula_3.To produce a random variable X with a Bernoulli distribution from a U(0,1) uniform distribution made by a random number generator, we define

formula_4

such that the probability forformula_5and formula_6.Define
For a fair coin, both realizations are equally likely.