Class RandomNormal

java.lang.Object
  extended by RandomNormal

public class RandomNormal
extends java.lang.Object

Class for sampling randomly from the Normal (Gaussian) distribution with a specified mean and standard deviation.


Constructor Summary
RandomNormal()
          Create RNG with all default values: no seed, no limits, standard normal distribution.
RandomNormal(double mean, double stdev)
          Create RNG with no seed, samples from normal distribution with given mean and standard deviation.
RandomNormal(int seed)
          Create RNG with specified seed for standard normal distribution.
RandomNormal(int seed, double mean, double stdev)
          Create RNG with specified seed, samples from normal distribution with given mean and standard deviation.
 
Method Summary
 double nextDouble()
          Take a sample from the distribution.
 double nextDouble(double min, double max)
          Take a sample from the distribution.
 int nextInt()
          Take a sample from the distribution.
 int nextInt(int min, int max)
          Take a sample from the distribution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomNormal

public RandomNormal()
Create RNG with all default values: no seed, no limits, standard normal distribution.


RandomNormal

public RandomNormal(int seed)
Create RNG with specified seed for standard normal distribution.

Parameters:
seed - int seed value, guarantees fixed sequence.

RandomNormal

public RandomNormal(double mean,
                    double stdev)
Create RNG with no seed, samples from normal distribution with given mean and standard deviation.

Parameters:
mean - Mean (average) of the distribution.
stdev - Standard deviation of the distribution.

RandomNormal

public RandomNormal(int seed,
                    double mean,
                    double stdev)
Create RNG with specified seed, samples from normal distribution with given mean and standard deviation.

Parameters:
seed - int seed value, guarantees fixed sequence.
mean - Mean (average) of the distribution.
stdev - Standard deviation of the distribution.
Method Detail

nextDouble

public double nextDouble()
Take a sample from the distribution.

Returns:
Double value sampled from the distribution

nextDouble

public double nextDouble(double min,
                         double max)
Take a sample from the distribution. If sample < min, re-samples if > max, re-samples.

Parameters:
min - Low end of range of acceptable values.
max - High end of range of acceptable values.
Returns:
Double value sampled from the distribution

nextInt

public int nextInt()
Take a sample from the distribution.

Returns:
Int value sampled from the distribution

nextInt

public int nextInt(int min,
                   int max)
Take a sample from the distribution. If sample < min, re-samples; if > max, re-samples.

Parameters:
min - Low end of range of acceptable values.
max - High end of range of acceptable values.
Returns:
Int value sampled from the distribution