Utility
Class Normal
java.lang.Object
|
+--Utility.RandomNumber
|
+--Utility.Normal
- public class Normal
- extends RandomNumber
Normal is used to generate random variables from
the normal distribution. A specific normal distribution
is characterized by a mean and a variance.
This is a continuous distribution.
Tests Performed
1000 samples were generated and the means and variances
were examined. Subjectively, they seemed correct.
A goodness of fit test was performed with 100 samples
and 10 intervals. It succeeded about 19/20 times.
Constructor Summary |
Normal(double mean,
double variance)
Normal constructor. |
Method Summary |
double |
getMean()
|
double |
getStdDev()
|
double |
getVariance()
|
double |
sampleDouble()
The sampleDouble function returns a random variable
that is chosen from a normal distribution with parameters
as set in the constructor. |
int |
sampleInt()
The sampleInt function should not be called for
this continuous distribution. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Normal
public Normal(double mean,
double variance)
- Normal constructor. Initialize the parameters of the
normal distribution.
- Parameters:
mean
- The mean of the distributionvariance
- The variance of the distribution
getMean
public double getMean()
getVariance
public double getVariance()
getStdDev
public double getStdDev()
sampleDouble
public double sampleDouble()
- The sampleDouble function returns a random variable
that is chosen from a normal distribution with parameters
as set in the constructor.
- Overrides:
sampleDouble
in class RandomNumber
- See Also:
Normal(double, double)
sampleInt
public int sampleInt()
- The sampleInt function should not be called for
this continuous distribution.
- Overrides:
sampleInt
in class RandomNumber