gov.sandia.cognition.statistics.distribution

## Class UniformDistribution

• ### Nested Class Summary

Nested Classes
Modifier and Type Class and Description
`static class ` `UniformDistribution.CDF`
Cumulative Distribution Function of a uniform
`static class ` `UniformDistribution.MaximumLikelihoodEstimator`
Maximum Likelihood Estimator of a uniform distribution.
`static class ` `UniformDistribution.PDF`
Probability density function of a Uniform Distribution
• ### Field Summary

Fields
Modifier and Type Field and Description
`static double` `DEFAULT_MAX`
Default max, 1.0.
`static double` `DEFAULT_MIN`
Default min, 0.0.
• ### Constructor Summary

Constructors
Constructor and Description
`UniformDistribution()`
Creates a new instance of UniformDistribution
```UniformDistribution(double minSupport, double maxSupport)```
Creates a new instance of UniformDistribution
`UniformDistribution(UniformDistribution other)`
Copy constructor
• ### Method Summary

All Methods
Modifier and Type Method and Description
`UniformDistribution` `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.
`UniformDistribution.CDF` `getCDF()`
Gets the CDF of a scalar distribution.
`UniformDistribution.MaximumLikelihoodEstimator` `getEstimator()`
Gets an estimator associated with this distribution.
`java.lang.Double` `getMaxSupport()`
Gets the minimum support (domain or input) of the distribution.
`double` `getMeanAsDouble()`
Gets the mean of the distribution as a double.
`java.lang.Double` `getMinSupport()`
Gets the minimum support (domain or input) of the distribution.
`UniformDistribution.PDF` `getProbabilityFunction()`
Gets the distribution function associated with this Distribution, either the PDF or PMF.
`double` `getVariance()`
Gets the variance of the distribution.
`java.lang.Double` `sample(java.util.Random random)`
Draws a single random sample from the distribution.
`void` ```sampleInto(java.util.Random random, double[] output, int start, int length)```
Samples values from this distribution as an array of doubles.
`void` `setMaxSupport(double maxSupport)`
Setter for maxSupport
`void` `setMinSupport(double minSupport)`
Setter for minSupport
• ### Methods inherited from class gov.sandia.cognition.statistics.AbstractClosedFormSmoothUnivariateDistribution

`getMean, sampleAsDouble, sampleAsDoubles, sampleInto`
• ### Methods inherited from class gov.sandia.cognition.statistics.AbstractDistribution

`sample`
• ### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Methods inherited from interface gov.sandia.cognition.statistics.Distribution

`sample, sampleInto`
• ### Field Detail

• #### DEFAULT_MIN

`public static final double DEFAULT_MIN`
Default min, 0.0.
Constant Field Values
• #### DEFAULT_MAX

`public static final double DEFAULT_MAX`
Default max, 1.0.
Constant Field Values
• ### Constructor Detail

• #### UniformDistribution

`public UniformDistribution()`
Creates a new instance of UniformDistribution
• #### UniformDistribution

```public UniformDistribution(double minSupport,
double maxSupport)```
Creates a new instance of UniformDistribution
Parameters:
`minSupport` - Minimum x bound on the distribution
`maxSupport` - Maximum bound on the distribution
• #### UniformDistribution

`public UniformDistribution(UniformDistribution other)`
Copy constructor
Parameters:
`other` - UniformDistribution to copy
• ### Method Detail

• #### clone

`public UniformDistribution clone()`
Description copied from class: `AbstractCloneableSerializable`
This makes public the clone method on the `Object` 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.
Specified by:
`clone` in interface `Vectorizable`
Specified by:
`clone` in interface `CloneableSerializable`
Overrides:
`clone` in class `AbstractClosedFormUnivariateDistribution<java.lang.Double>`
Returns:
A clone of this object.
• #### getMeanAsDouble

`public double getMeanAsDouble()`
Description copied from interface: `UnivariateDistribution`
Gets the mean of the distribution as a double.
Specified by:
`getMeanAsDouble` in interface `UnivariateDistribution<java.lang.Double>`
Returns:
The mean as a double.
• #### getVariance

`public double getVariance()`
Description copied from interface: `UnivariateDistribution`
Gets the variance of the distribution. This is sometimes called the second central moment by more pedantic people, which is equivalent to the square of the standard deviation.
Specified by:
`getVariance` in interface `UnivariateDistribution<java.lang.Double>`
Returns:
Variance of the distribution.
• #### sample

`public java.lang.Double sample(java.util.Random random)`
Description copied from interface: `Distribution`
Draws a single random sample from the distribution.
Specified by:
`sample` in interface `Distribution<java.lang.Double>`
Overrides:
`sample` in class `AbstractDistribution<java.lang.Double>`
Parameters:
`random` - Random-number generator to use in order to generate random numbers.
Returns:
Sample drawn according to this distribution.
• #### sampleInto

```public void sampleInto(java.util.Random random,
double[] output,
int start,
int length)```
Description copied from interface: `SmoothUnivariateDistribution`
Samples values from this distribution as an array of doubles. This is a convenience method to potentially avoid boxing.
Specified by:
`sampleInto` in interface `SmoothUnivariateDistribution`
Parameters:
`random` - Random number generator to use.
`output` - The array to write the result into. Cannot be null.
`start` - The offset in the array to start writing at. Cannot be negative.
`length` - The number of values to sample. Cannot be negative.
• #### getMinSupport

`public java.lang.Double getMinSupport()`
Description copied from interface: `UnivariateDistribution`
Gets the minimum support (domain or input) of the distribution.
Specified by:
`getMinSupport` in interface `UnivariateDistribution<java.lang.Double>`
Returns:
Minimum support.
• #### setMinSupport

`public void setMinSupport(double minSupport)`
Setter for minSupport
Parameters:
`minSupport` - Minimum x bound on the distribution
• #### getMaxSupport

`public java.lang.Double getMaxSupport()`
Description copied from interface: `UnivariateDistribution`
Gets the minimum support (domain or input) of the distribution.
Specified by:
`getMaxSupport` in interface `UnivariateDistribution<java.lang.Double>`
Returns:
Minimum support.
• #### setMaxSupport

`public void setMaxSupport(double maxSupport)`
Setter for maxSupport
Parameters:
`maxSupport` - Maximum x bound on the distribution
• #### convertToVector

`public Vector convertToVector()`
Description copied from interface: `Vectorizable`
Converts the object to a vector.
Specified by:
`convertToVector` in interface `Vectorizable`
Returns:
The Vector form of the object.
• #### convertFromVector

`public void convertFromVector(Vector parameters)`
Description copied from interface: `Vectorizable`
Converts the object from a Vector of parameters.
Specified by:
`convertFromVector` in interface `Vectorizable`
Parameters:
`parameters` - The parameters to incorporate.
• #### getCDF

`public UniformDistribution.CDF getCDF()`
Description copied from interface: `UnivariateDistribution`
Gets the CDF of a scalar distribution.
Specified by:
`getCDF` in interface `ClosedFormUnivariateDistribution<java.lang.Double>`
Specified by:
`getCDF` in interface `SmoothUnivariateDistribution`
Specified by:
`getCDF` in interface `UnivariateDistribution<java.lang.Double>`
Returns:
CDF of the scalar distribution.
• #### getProbabilityFunction

`public UniformDistribution.PDF getProbabilityFunction()`
Description copied from interface: `ComputableDistribution`
Gets the distribution function associated with this Distribution, either the PDF or PMF.
Specified by:
`getProbabilityFunction` in interface `ComputableDistribution<java.lang.Double>`
Specified by:
`getProbabilityFunction` in interface `SmoothUnivariateDistribution`
Returns:
Distribution function associated with this Distribution.
• #### getEstimator

`public UniformDistribution.MaximumLikelihoodEstimator getEstimator()`
Description copied from interface: `EstimableDistribution`
Gets an estimator associated with this distribution.
Specified by:
`getEstimator` in interface `EstimableDistribution<java.lang.Double,UniformDistribution>`
Returns:
A distribution estimator associated for this distribution.