public class DiscreteUniformDistribution extends FiniteDistribution implements java.io.Serializable
CONTINUOUS, DISCRETE, MIXED
Constructor and Description |
---|
DiscreteUniformDistribution()
This default constructor creates a new discrete uniform distribution
on {1, 2, 3, 4, 5, 6}.
|
DiscreteUniformDistribution(double a,
double b,
double w)
This general constructor creates a new discrete uniform distribution
on a specified domain.
|
Modifier and Type | Method and Description |
---|---|
void |
setParameters(double a,
double b,
double w,
double[] p)
This method sets the finite distribution parameters to ensure that
the uniform distribution is not changed.
|
void |
setProbabilities(double[] p)
This method sets the probabilities to ensure that the uniform
distribution is not changed.
|
double |
simulate()
This method simulates a value from the distribution.
|
java.lang.String |
toString()
This method returns a string that gives the name of the distribution and the values of
the parameters.
|
getDensity, getLowerValue, getProbabilities, getProbabilities, getSize, getUpperValue, getWidth, setLowerValue, setParameters, setProbabilities, setUpperValue, setWidth
getCDF, getDomain, getFailureRate, getMaxDensity, getMean, getMedian, getMGF, getMoment, getMoment, getPGF, getQuantile, getSD, getType, getVariance, setDomain, setDomain
public DiscreteUniformDistribution(double a, double b, double w)
a
- the lower value of the domainb
- the upper value of the domainw
- the step size of the domainpublic DiscreteUniformDistribution()
public double simulate()
simulate
in class Distribution
public void setProbabilities(double[] p)
setProbabilities
in class FiniteDistribution
p
- the array of probabilitiespublic void setParameters(double a, double b, double w, double[] p)
setParameters
in class FiniteDistribution
a
- the lower valueb
- the upper valuew
- the widthp
- the array of probabilitiespublic java.lang.String toString()
toString
in class FiniteDistribution