public class PoissonVariate extends RandomVariateBase implements DiscreteRandomVariate
Modifier and Type | Field and Description |
---|---|
protected double |
a
A pre-calculated value to aid in generation.
|
protected double |
mean
The desired mean of this PoissonVariate.
|
protected RandomVariate |
normalVariate
To be used for large values of the mean
|
protected boolean |
useNormalApproximation |
rng
Constructor and Description |
---|
PoissonVariate()
Creates new PoissonVariate; the mean must be set prior to use.
|
Modifier and Type | Method and Description |
---|---|
double |
generate()
Generates a random variate having this class's distribution.
|
int |
generateInt() |
double |
getMean() |
java.lang.Object[] |
getParameters()
Returns a single element array containing the mean as a Double.
|
void |
setMean(double mean) |
void |
setParameters(java.lang.Object... params)
Sets the desired mean of the RadomVariate.
|
java.lang.String |
toString()
Returns a String containing the name and mean of this RandomVariate.
|
getRandomNumber, setRandomNumber
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getRandomNumber, setRandomNumber
protected double mean
protected double a
protected RandomVariate normalVariate
protected boolean useNormalApproximation
public PoissonVariate()
public java.lang.Object[] getParameters()
getParameters
in interface RandomVariate
public void setParameters(java.lang.Object... params)
setParameters
in interface RandomVariate
params
- A single element array containing the mean as a Number.java.lang.IllegalArgumentException
- If the array does not have exactly 1
element, if the element is not a Number, or if the mean if not positive.public int generateInt()
generateInt
in interface DiscreteRandomVariate
int
.public double generate()
generate
in interface RandomVariate
public void setMean(double mean)
mean
- the desired mean.java.lang.IllegalArgumentException
- If the mean is not positive.public double getMean()
public java.lang.String toString()
toString
in class java.lang.Object