Class RandomExponential

java.lang.Object
  extended by RandomExponential

public class RandomExponential
extends java.lang.Object

Class for sampling randomly from the Exponential distribution with a specified mean.


Constructor Summary
RandomExponential(double mean)
          Create RNG with no seed, samples from exponential distribution with given mean.
RandomExponential(int seed, double mean)
          Create RNG with specified seed, samples from exponential distribution with given mean.
 
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

RandomExponential

public RandomExponential(double mean)
Create RNG with no seed, samples from exponential distribution with given mean.

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

RandomExponential

public RandomExponential(int seed,
                         double mean)
Create RNG with specified seed, samples from exponential distribution with given mean.

Parameters:
seed - int seed value, guarantees fixed sequence.
mean - Mean (average) 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