bernoulli
Probability mass function 

Distribution 

Mean 

Variance 

The Bernoulli distribution is a discrete probability distribution, which takes value 1
with success probability p and value 0 with failure probability q = 1
− p.
 bernoulli(double
p)

Description
Generates a sample of the Bernoulli distribution, i.e. 1
with
probability p and 0 with probability 1  p.
Parameters
Name 
Type 
Description 
p 
double 
the
probability of 1 
Result
Type 
Description 
int 
the
generated sample 
 bernoulli(double
p,
java.util.Random r)

Description
Generates a sample of the Bernoulli
distribution using the
specified random number generator.
Parameters
Name 
Type 
Description 
p 
double 
the
probability of 1 
r 
java.util.Random 
the
random
number generator 
Result
Type 
Description 
int 
the
generated sample 