edu.indiana.util.distribution
Class ClampedNormalDistribution

java.lang.Object
  extended by edu.indiana.util.distribution.NormalDistribution
      extended by edu.indiana.util.distribution.ClampedNormalDistribution
All Implemented Interfaces:
Distribution, java.io.Serializable, java.lang.Cloneable

public class ClampedNormalDistribution
extends NormalDistribution

This is a normal distribution, but with firm minimum and maximum values.

See Also:
Serialized Form

Field Summary
protected  double max
           
protected  double min
           
static double UNCLAMPED
           
 
Fields inherited from class edu.indiana.util.distribution.NormalDistribution
mean, standardDeviation
 
Constructor Summary
ClampedNormalDistribution(double mean, double standardDeviation, double min, double max)
          Creates a new instance of ClampedNormalDistribution
 
Method Summary
 java.lang.Object clone()
          Obtain a copy of this distribution.
 boolean equals(java.lang.Object other)
           
 double generateValue()
          Generate a random double from a normal distribution with a specified mean and standard deviation.
 double getMax()
           
 double getMin()
           
static void main(java.lang.String[] args)
           
 void setParameters(double[] parameters)
          Set the parameters for this clamped normal distribution.
 java.lang.String toString()
          Obtain a String representation of this distribution.
 
Methods inherited from class edu.indiana.util.distribution.NormalDistribution
generateIntValue
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNCLAMPED

public static final double UNCLAMPED
See Also:
Constant Field Values

min

protected double min

max

protected double max
Constructor Detail

ClampedNormalDistribution

public ClampedNormalDistribution(double mean,
                                 double standardDeviation,
                                 double min,
                                 double max)
Creates a new instance of ClampedNormalDistribution

Method Detail

generateValue

public double generateValue()
Description copied from class: NormalDistribution
Generate a random double from a normal distribution with a specified mean and standard deviation. This algorithm is from _The_Art_Of_Computer_Programming_ by Donald Knuth, 2nd ed, p. 117.

Specified by:
generateValue in interface Distribution
Overrides:
generateValue in class NormalDistribution

setParameters

public void setParameters(double[] parameters)
Set the parameters for this clamped normal distribution. The first position in the array is the mean, the second is the standard deviation, the third is the minimum, and the fourth is the maximum.

Specified by:
setParameters in interface Distribution
Overrides:
setParameters in class NormalDistribution

getMin

public double getMin()

getMax

public double getMax()

toString

public java.lang.String toString()
Obtain a String representation of this distribution.

Specified by:
toString in interface Distribution
Overrides:
toString in class NormalDistribution

clone

public java.lang.Object clone()
Obtain a copy of this distribution.

Specified by:
clone in interface Distribution
Overrides:
clone in class NormalDistribution

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class NormalDistribution

main

public static void main(java.lang.String[] args)