drasys.or.prob
Class LinearCongruential

java.lang.Object
  |
  +--drasys.or.prob.LinearCongruential

public class LinearCongruential
extends java.lang.Object
implements RandomI, java.io.Serializable

An implementation of a 48 bit linear congruential random number generator.

See Also:
MultiplicativeCongruantial,

References:

The Art of Computer Programming: Seminumerical Algorithms (Vol 2, 3rd Ed)
    Donald Ervin Knuth; Hardcover
Numerical Recipes in C : The Art of Scientific Computing
    William H. Press, et al / Hardcover / Published 1993
Probability and Statistics
    Morris H. Degroot / Hardcover / Published 1986
Mathematical Statistics With Applications
    Dennis D. Wackerly, et al / Hardcover / Published 1996
, Serialized Form


Constructor Summary
LinearCongruential()
           
LinearCongruential(long seed)
          For the default values see
 
Method Summary
 long next()
          Gets the next number from the generator.
 double nextDouble()
          Gets the next double value from the generator.
 void setSeed(long seed)
          Sets the seed for the random number generator.
 int sizeOfBits()
          Gets the number of valid bits in a long value returned from the generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearCongruential

public LinearCongruential()

LinearCongruential

public LinearCongruential(long seed)
For the default values see
Method Detail

setSeed

public void setSeed(long seed)
Sets the seed for the random number generator.
Specified by:
setSeed in interface RandomI

nextDouble

public double nextDouble()
Gets the next double value from the generator.
Specified by:
nextDouble in interface RandomI
Returns:
a random value between 0.0 and 1.0;

sizeOfBits

public int sizeOfBits()
Gets the number of valid bits in a long value returned from the generator.
Specified by:
sizeOfBits in interface RandomI
Returns:
48 always.

next

public long next()
Gets the next number from the generator.
Specified by:
next in interface RandomI
Returns:
a 48 bit value;


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com