@PublicationReference(author="Wikipedia", title="Uniform distribution (discrete)", type=WebPage, year=2015, url="https://en.wikipedia.org/wiki/Uniform_distribution_(discrete)") public class UniformIntegerDistribution extends AbstractClosedFormIntegerDistribution implements ClosedFormDiscreteUnivariateDistribution<java.lang.Number>, EstimableDistribution<java.lang.Number,UniformIntegerDistribution>
| Modifier and Type | Class and Description |
|---|---|
static class |
UniformIntegerDistribution.CDF
Implements the cumulative distribution function for the discrete
uniform distribution.
|
static class |
UniformIntegerDistribution.MaximumLikelihoodEstimator
Implements a maximum likelihood estimator for the discrete uniform
distribution.
|
static class |
UniformIntegerDistribution.PMF
Probability mass function of a discrete uniform distribution.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_SUPPORT
The default maximum support is 0.
|
static int |
DEFAULT_MIN_SUPPORT
The default minimum support is 0.
|
| Constructor and Description |
|---|
UniformIntegerDistribution()
Creates a new
UniformIntegerDistribution with default parameters. |
UniformIntegerDistribution(int minSupport,
int maxSupport)
Creates a new
UniformIntegerDistribution with the given bounds. |
UniformIntegerDistribution(UniformIntegerDistribution other)
Creates a new
UniformIntegerDistribution that is a copy of the
given other distribution. |
| Modifier and Type | Method and Description |
|---|---|
UniformIntegerDistribution |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
void |
convertFromVector(Vector parameters)
Converts the object from a Vector of parameters.
|
Vector |
convertToVector()
Converts the object to a vector.
|
UniformIntegerDistribution.CDF |
getCDF()
Gets the CDF of a scalar distribution.
|
java.util.Set<? extends java.lang.Number> |
getDomain()
Returns an object that allows an iteration through the domain
(x-axis, independent variable) of the Distribution
|
int |
getDomainSize()
Gets the size of the domain.
|
UniformIntegerDistribution.MaximumLikelihoodEstimator |
getEstimator()
Gets an estimator associated with this distribution.
|
java.lang.Integer |
getMaxSupport()
Gets the minimum support (domain or input) of the distribution.
|
java.lang.Number |
getMean()
Gets the arithmetic mean, or "first central moment" or "expectation",
of the distribution.
|
double |
getMeanAsDouble()
Gets the mean of the distribution as a double.
|
java.lang.Integer |
getMinSupport()
Gets the minimum support (domain or input) of the distribution.
|
UniformIntegerDistribution.PMF |
getProbabilityFunction()
Gets the distribution function associated with this Distribution,
either the PDF or PMF.
|
double |
getVariance()
Gets the variance of the distribution.
|
int |
sampleAsInt(java.util.Random random)
Draws a single random sample from the distribution as an int.
|
void |
sampleInto(java.util.Random random,
int sampleCount,
java.util.Collection<? super java.lang.Number> output)
Draws multiple random samples from the distribution and puts the result
into the given collection.
|
void |
setMaxSupport(int maxSupport)
Sets the maximum support.
|
void |
setMinSupport(int minSupport)
Sets the minimum support.
|
sampleAsInts, sampleIntosample, sampleequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsample, samplepublic static final int DEFAULT_MIN_SUPPORT
public static final int DEFAULT_MAX_SUPPORT
public UniformIntegerDistribution()
UniformIntegerDistribution with default parameters.public UniformIntegerDistribution(int minSupport,
int maxSupport)
UniformIntegerDistribution with the given bounds.minSupport - The minimum bound on the distribution (inclusive).maxSupport - The maximum bound on the distribution (exclusive).public UniformIntegerDistribution(UniformIntegerDistribution other)
UniformIntegerDistribution that is a copy of the
given other distribution.other - The distribution to copy.public UniformIntegerDistribution clone()
AbstractCloneableSerializableObject class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone() to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone() as the basis for your implementation.clone in interface Vectorizableclone in interface CloneableSerializableclone in class AbstractClosedFormUnivariateDistribution<java.lang.Number>public UniformIntegerDistribution.PMF getProbabilityFunction()
ComputableDistributiongetProbabilityFunction in interface ComputableDistribution<java.lang.Number>getProbabilityFunction in interface DiscreteDistribution<java.lang.Number>public UniformIntegerDistribution.CDF getCDF()
UnivariateDistributiongetCDF in interface ClosedFormUnivariateDistribution<java.lang.Number>getCDF in interface UnivariateDistribution<java.lang.Number>public java.lang.Number getMean()
DistributionWithMeangetMean in interface DistributionWithMean<java.lang.Number>public Vector convertToVector()
VectorizableconvertToVector in interface Vectorizablepublic void convertFromVector(Vector parameters)
VectorizableconvertFromVector in interface Vectorizableparameters - The parameters to incorporate.public java.lang.Integer getMinSupport()
UnivariateDistributiongetMinSupport in interface UnivariateDistribution<java.lang.Number>public void setMinSupport(int minSupport)
minSupport - The minimum support.public java.lang.Integer getMaxSupport()
UnivariateDistributiongetMaxSupport in interface UnivariateDistribution<java.lang.Number>public void setMaxSupport(int maxSupport)
maxSupport - The maximum support.public double getMeanAsDouble()
UnivariateDistributiongetMeanAsDouble in interface UnivariateDistribution<java.lang.Number>public double getVariance()
UnivariateDistributiongetVariance in interface UnivariateDistribution<java.lang.Number>public java.util.Set<? extends java.lang.Number> getDomain()
DiscreteDistributiongetDomain in interface DiscreteDistribution<java.lang.Number>public int getDomainSize()
DiscreteDistributiongetDomainSize in interface DiscreteDistribution<java.lang.Number>public int sampleAsInt(java.util.Random random)
IntegerDistributionsampleAsInt in interface IntegerDistributionrandom - The random number generator to use.public void sampleInto(java.util.Random random,
int sampleCount,
java.util.Collection<? super java.lang.Number> output)
DistributionsampleInto in interface Distribution<java.lang.Number>random - Random number generator to use.sampleCount - The number of samples to draw. Cannot be negative.output - The collection to add the samples into.public UniformIntegerDistribution.MaximumLikelihoodEstimator getEstimator()
EstimableDistributiongetEstimator in interface EstimableDistribution<java.lang.Number,UniformIntegerDistribution>