org.activemq.transport.reliable
Class SMLCGRandom

java.lang.Object
  extended byorg.activemq.transport.reliable.SMLCGRandom

public class SMLCGRandom
extends Object

A Shuffled Multiple Combined Linear Congruential Generator Uses L'Ecuyer's CLCG4 with a Bays-Durham shuffle. From Numerical Recipes inC This produces a more random stream of results than just java.util.Random

Version:
$Revision: 1.1.1.1 $

Constructor Summary
SMLCGRandom()
          Creates a new pseudorandom number generator, seeded from the current time.
SMLCGRandom(long seed)
          Creates the generator with the provided seed
 
Method Summary
 byte nextByte()
           
 double nextDouble()
           
 float nextFloat()
           
 int nextInt()
           
 long nextLong()
           
 short nextShort()
           
 void setSeed(long seed)
          Set the seed for the random generator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMLCGRandom

public SMLCGRandom()
Creates a new pseudorandom number generator, seeded from the current time.


SMLCGRandom

public SMLCGRandom(long seed)
Creates the generator with the provided seed

Parameters:
seed -
Method Detail

setSeed

public void setSeed(long seed)
             throws IllegalArgumentException
Set the seed for the random generator

Parameters:
seed -
Throws:
IllegalArgumentException

nextShort

public short nextShort()
Returns:
the next random, uniformly distrubted, short value

nextInt

public int nextInt()
Returns:
the next random, uniformly distrubted, int value

nextLong

public long nextLong()
Returns:
the next random, uniformly distrubted, long value

nextFloat

public float nextFloat()
Returns:
the next random, uniformly distributed, float value, greater than or equal to 0 and less than 1.

nextDouble

public double nextDouble()
Returns:
the next random, uniformly distributed, double value, greater than or equal to 0 and less than 1.

nextByte

public byte nextByte()
Returns:
the next random, uniformly distrubted, byte value


Copyright © 2004-2007 Protique, Ltd.. All Rights Reserved.