Probability mass function | |
Distribution | |
Mean | |
Variance |
The Bernoulli distribution is a discrete probability distribution with two possible outcomes (“success” and “failure”). It takes value 1 with probability of success p and value 0 with probability of failure q = 1 - p.
bernoulli(0.6) results in 60% chance of success (returns 1 with 60% probability).
- Description
- Generates a sample of the Bernoulli distribution, that is, 1 with probability p and 0 with probability 1 - p.
- Parameters
-
Name Type of value Description p double The probability of 1. - Result
-
Type Description int The generated sample.
- Description
- Generates a sample of the Bernoulli distribution using the specified random number generator.
- Parameters
-
Name Type of value Description p double The probability of 1. r java.util.Random The random number generator. - Result
-
Type Description int The generated sample.
-
How can we improve this article?
-