public class BinomialDistribution extends DiscreteDistribution
name| Constructor and Description |
|---|
BinomialDistribution(java.lang.String name,
int n,
double p)
Generates the distribution for a fixed number of trials n with a success probability p.
|
| Modifier and Type | Method and Description |
|---|---|
double |
draw()
Draws a value from the distribution randomly
through returning the value for which the cumulative distribution
of this Binomial distribution corresponds to a value drawn from a normal distribution
|
int |
getN()
Resets the probability of success for individual Bernoulli experiments of the distribution
|
double |
getP() |
getName, toStringpublic BinomialDistribution(java.lang.String name,
int n,
double p)
throws java.lang.IllegalArgumentException
name - Name of the distribution to model (will be prefixed by Binomial_Distribution)n - The number of tries / independent trials of Bernoulli experimentsp - probability of success for each Bernoulli experimentjava.lang.IllegalArgumentException - Will be thrown when parameters are illegal (n negative or p not in unit interval ([0,1]))public double draw()
draw in class UnivariateDistributionpublic int getN()
p - Probability of success of each individual Bernoulli experimentjava.lang.IllegalArgumentException - gets thrown when an illegal value is provided for p (outside of unit interval [0,1])public double getP()