jp.ac.hiroshima_u.sci.math.saito.tinymt
Class TinyMT

java.lang.Object
  extended by java.util.Random
      extended by jp.ac.hiroshima_u.sci.math.saito.tinymt.TinyMT
All Implemented Interfaces:
java.io.Serializable

public class TinyMT
extends java.util.Random

TinyMT is a pseudo random number generator. To get an instance, call getDefault(long). This class is not synchronized, One way to use TinyMT in multithread environment is to use an instance per a thread. This class supports jump function. User can get an array of pseudo random number generators by calling getDefaultArray(int, long, int). Currently this class supports only one parameter of TinyMT.

Author:
M. Saito
See Also:
TinyMT web page, Serialized Form

Method Summary
static TinyMT getDefault(long seed)
          Factory method which returns the TinyMT with the first generated parameter of TinyMTDC.
static TinyMT[] getDefaultArray(int num, long seed, int jump)
          make and return an array of TinyMT.
 void setSeed(int[] seeds)
          seeding by array of integers.
 void setSeed(long seed)
           
 void setSeed(java.lang.String seed)
          seeding by string, This will be convenient.
 
Methods inherited from class java.util.Random
nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setSeed

public void setSeed(long seed)
Overrides:
setSeed in class java.util.Random

setSeed

public void setSeed(java.lang.String seed)
seeding by string, This will be convenient. This function does not compatible from other language implementation because coding of characters are different.

Parameters:
seed - seed of pseudo random numbers

setSeed

public void setSeed(int[] seeds)
seeding by array of integers. This seeding is compatible with other language implementation.

Parameters:
seeds - seeds of pseudo random numbers.

getDefault

public static TinyMT getDefault(long seed)
Factory method which returns the TinyMT with the first generated parameter of TinyMTDC.

Parameters:
seed - seed of pseudo random numbers.
Returns:
TinyMT with the first parameter.

getDefaultArray

public static TinyMT[] getDefaultArray(int num,
                                       long seed,
                                       int jump)
make and return an array of TinyMT. The second element has the state of jump * 264 steps after the first element. In other word, the first element will generate the same sequence with the second element, after jump * 264 pseudo random number generation.

Parameters:
seed - seed of first element
jump - step is jump * 264
Returns:
array of TinyMT