drasys.or.prob
Class BaysDurhamShuffle

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

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

An implementation of the Bayes and Durham shuffle to eliminate serial correlation. The algorithm maintains a pool of 32 random numbers from the underlying generator. A number is drawn from the pool and used to select its successor.

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

See Also:
LinearCongruential, MultiplicativeCongruential, Serialized Form

Constructor Summary
BaysDurhamShuffle()
          The default random number generator is 'LinearCongruential'.
BaysDurhamShuffle(long seed)
          The default random number generator is 'LinearCongruential'.
BaysDurhamShuffle(RandomI random)
           
 
Method Summary
 long next()
          Gets the next long value 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

BaysDurhamShuffle

public BaysDurhamShuffle()
The default random number generator is 'LinearCongruential'.

BaysDurhamShuffle

public BaysDurhamShuffle(long seed)
The default random number generator is 'LinearCongruential'.

BaysDurhamShuffle

public BaysDurhamShuffle(RandomI random)
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:
the size of the bits of the underlying generator.

next

public long next()
Gets the next long value from the generator.
Specified by:
next in interface RandomI


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