edu.indiana.util.distribution
Class NormalDistribution

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

public class NormalDistribution
extends java.lang.Object
implements Distribution, java.lang.Cloneable

A specification of a normal random distribution.

See Also:
Serialized Form

Field Summary
protected  double mean
           
protected  double standardDeviation
           
 
Constructor Summary
NormalDistribution()
          Construct a NormalDistribution.
NormalDistribution(double mean, double standardDeviation)
          Creates new NormalDistribution
 
Method Summary
 java.lang.Object clone()
          Obtain a copy of this distribution.
 boolean equals(java.lang.Object other)
           
 int generateIntValue()
          Generate an int value according to this distribution.
 double generateValue()
          Generate a random double from a normal distribution with a specified mean and standard deviation.
static void main(java.lang.String[] args)
           
 void setParameters(double[] parameters)
          Set the parameters for this normal distribution.
 java.lang.String toString()
          Obtain a String representation of this distribution.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mean

protected double mean

standardDeviation

protected double standardDeviation
Constructor Detail

NormalDistribution

public NormalDistribution()
Construct a NormalDistribution. Parameters must be set with setParameters().


NormalDistribution

public NormalDistribution(double mean,
                          double standardDeviation)
Creates new NormalDistribution

Method Detail

generateValue

public double generateValue()
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

generateIntValue

public int generateIntValue()
Description copied from interface: Distribution
Generate an int value according to this distribution.

Specified by:
generateIntValue in interface Distribution

setParameters

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

Specified by:
setParameters in interface Distribution

toString

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

Specified by:
toString in interface Distribution
Overrides:
toString in class java.lang.Object

clone

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

Specified by:
clone in interface Distribution
Overrides:
clone in class java.lang.Object

equals

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

main

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