GridSim 5.0 beta

gridsim.util
Class LCGRandom

Object
  extended by LCGRandom

public class LCGRandom
extends Object

Basic random number generator. It is a multiplicative Linear Congruential Generator (LCG). The generator can be adjusted simply by changing the constants MULTIPIER and MODULUS (be careful). The complete generated stream of MODULUS numbers is split into MAX_STREAMS (stream from 0 to MAX_STREAMS - 1) by appropriate setting of the SEED array (again be careful).
NOTE: This class is taken from JSim.

Since:
GridSim Toolkit 4.1

Constructor Summary
LCGRandom(int stream)
          Constructs an LCG-based Random Number Generator.
 
Method Summary
 double gen()
          Generates a real-valued random number in the range 0 to 1.
 Double[] getParameters()
          Get the parameters of the constuctor
 long igen()
          Generates an integer-valued random number in the range 0 to MODULUS - 1.
 void incrStream()
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LCGRandom

public LCGRandom(int stream)
Constructs an LCG-based Random Number Generator.

Parameters:
stream - stream number (integer from 0 to MAX_STREAMS - 1)
Method Detail

incrStream

public void incrStream()

getParameters

public Double[] getParameters()
Get the parameters of the constuctor


gen

public double gen()
Generates a real-valued random number in the range 0 to 1.

Returns:
double random number

igen

public long igen()
Generates an integer-valued random number in the range 0 to MODULUS - 1.

Returns:
long integer-valued random number

GridSim 5.0 beta

The University of Melbourne, Australia, 2009