cz.zcu.fav.kiv.jsim.random
Class JSimExponentialStream

java.lang.Object
  extended by cz.zcu.fav.kiv.jsim.random.JSimExponentialStream

public class JSimExponentialStream
extends java.lang.Object

A stream generating random real values with an exponential distribution with a given lambda. The lambda parameter is set by the user when the stream is constructed. An initial seed can be specified, which allows you to generate the same sequence of random values several times. A complex description of exponential distribution can be found at Wolfram Research Math World pages.

Since:
J-Sim version 0.3.0
Version:
J-Sim version 0.6.0
Author:
Jarda KAČER

Field Summary
private  double lambda
          The lambda parameter of the distribution, also called the rate of change.
protected  java.util.Random stream
          An internal stream from which random numbers are taken and modified.
 
Constructor Summary
JSimExponentialStream(double lambda)
          Creates a new stream generating random real values with exponential distribution.
JSimExponentialStream(double lambda, long seed)
          Creates a new stream generating random real values with exponential distribution.
 
Method Summary
 double getLambda()
          Returns the lambda parameter of the distribution.
 double getNext()
          Returns a randomly generated real value having exponential distribution with the given lambda parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stream

protected java.util.Random stream
An internal stream from which random numbers are taken and modified.


lambda

private double lambda
The lambda parameter of the distribution, also called the rate of change.

Constructor Detail

JSimExponentialStream

public JSimExponentialStream(double lambda)
                      throws JSimInvalidParametersException
Creates a new stream generating random real values with exponential distribution. A pseudo-randomly generated seed will be used.

Parameters:
lambda - The lambda parameter of the distribution.
Throws:
JSimInvalidParametersException - This exception is thrown out if lambda is less than 0.

JSimExponentialStream

public JSimExponentialStream(double lambda,
                             long seed)
                      throws JSimInvalidParametersException
Creates a new stream generating random real values with exponential distribution. The seed given as the second argument will be used.

Parameters:
lambda - The lambda parameter of the distribution.
seed - A seed that will initialize the generator.
Throws:
JSimInvalidParametersException - This exception is thrown out if lambda is less than 0.
Method Detail

getNext

public double getNext()
Returns a randomly generated real value having exponential distribution with the given lambda parameter.

Returns:
A random real value with exponential distribution.

getLambda

public double getLambda()
Returns the lambda parameter of the distribution.

Returns:
The lambda parameter of the distribution.


Copyright © 2000-2006 University of West Bohemia. Licensed under the Academic Free License v. 2.1. Build date 20060812.