cern.jet.random.engine
Class RandomSeedGenerator

java.lang.Object
  extended by cern.colt.PersistentObject
      extended by cern.jet.random.engine.RandomSeedGenerator
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class RandomSeedGenerator
extends PersistentObject

Deterministic seed generator for pseudo-random number generators. The sole purpose of this class is to decorrelate seeds and uniform random number generators. (If a generator would be used to generate seeds for itself, the result could be correlations.)

This class has entirelly deterministic behaviour: Constructing two instances with the same parameters at any two distinct points in time will produce identical seed sequences. However, it does not (at all) generate uniformly distributed numbers. Do not use it as a uniformly distributed random number generator!

Each generated sequence of seeds has a period of 109 numbers. Internally uses RandomSeedTable.

Author:
wolfgang.hoschek@cern.ch
See Also:
Serialized Form

Field Summary
protected  int column
           
protected  int row
           
 
Fields inherited from class cern.colt.PersistentObject
serialVersionUID
 
Constructor Summary
RandomSeedGenerator()
          Constructs and returns a new seed generator.
RandomSeedGenerator(int row, int column)
          Constructs and returns a new seed generator; you normally won't need to use this method.
 
Method Summary
static void main(java.lang.String[] args)
          Prints the generated seeds for the given input parameters.
 int nextSeed()
          Returns the next seed.
 void print(int size)
          Prints the next size generated seeds.
 
Methods inherited from class cern.colt.PersistentObject
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

row

protected int row

column

protected int column
Constructor Detail

RandomSeedGenerator

public RandomSeedGenerator()
Constructs and returns a new seed generator.


RandomSeedGenerator

public RandomSeedGenerator(int row,
                           int column)
Constructs and returns a new seed generator; you normally won't need to use this method.

The position [row,column] indicates the iteration starting point within a (virtual) seed matrix. The seed matrix is a n*m matrix with 1 + Integer.MAX_VALUE (virtual) rows and RandomSeedTable.COLUMNS columns. Successive calls to method nextSeed() will cycle over the given column, in ascending order: nextSeed() returns the seed s[row,column], s[row+1,column], ... s[Integer.MAX_VALUE,column], s[0,column], s[1,column], ...

Parameters:
row - should be in [0,Integer.MAX_VALUE].
column - should be in [0,RandomSeedTable.COLUMNS - 1].
Method Detail

main

public static void main(java.lang.String[] args)
Prints the generated seeds for the given input parameters.


nextSeed

public int nextSeed()
Returns the next seed.


print

public void print(int size)
Prints the next size generated seeds.