Added a routine to generate random numbers from a Bernoulli distribution.