edu.uah.math.distributions
Class DiscreteUniformDistribution

java.lang.Object
  extended by edu.uah.math.distributions.Distribution
      extended by edu.uah.math.distributions.FiniteDistribution
          extended by edu.uah.math.distributions.DiscreteUniformDistribution
All Implemented Interfaces:
java.io.Serializable

public class DiscreteUniformDistribution
extends FiniteDistribution
implements java.io.Serializable

This class models the discrete uniform distribution on a finite set.

Version:
August, 2003
Author:
Kyle Siegrist, Dawn Duehring
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.uah.math.distributions.Distribution
CONTINUOUS, DISCRETE, MIXED
 
Constructor Summary
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.
 
Method Summary
 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.
 
Methods inherited from class edu.uah.math.distributions.FiniteDistribution
getDensity, getLowerValue, getProbabilities, getProbabilities, getSize, getUpperValue, getWidth, setLowerValue, setParameters, setProbabilities, setUpperValue, setWidth
 
Methods inherited from class edu.uah.math.distributions.Distribution
getCDF, getDomain, getFailureRate, getMaxDensity, getMean, getMedian, getMGF, getMoment, getMoment, getPGF, getQuantile, getSD, getType, getVariance, setDomain, setDomain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DiscreteUniformDistribution

public DiscreteUniformDistribution(double a,
                                   double b,
                                   double w)
This general constructor creates a new discrete uniform distribution on a specified domain.

Parameters:
a - the lower value of the domain
b - the upper value of the domain
w - the step size of the domain

DiscreteUniformDistribution

public DiscreteUniformDistribution()
This default constructor creates a new discrete uniform distribution on {1, 2, 3, 4, 5, 6}.

Method Detail

simulate

public double simulate()
This method simulates a value from the distribution.

Overrides:
simulate in class Distribution
Returns:
a simulated value from the distribution

setProbabilities

public void setProbabilities(double[] p)
This method sets the probabilities to ensure that the uniform distribution is not changed.

Overrides:
setProbabilities in class FiniteDistribution
Parameters:
p - the array of probabilities

setParameters

public 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.

Overrides:
setParameters in class FiniteDistribution
Parameters:
a - the lower value
b - the upper value
w - the width
p - the array of probabilities

toString

public java.lang.String toString()
This method returns a string that gives the name of the distribution and the values of the parameters.

Overrides:
toString in class FiniteDistribution
Returns:
a string giving the name of the distribution and the values of the parameters