nl.tudelft.simulation.jstats.streams
Class MersenneTwister

java.lang.Object
  extended by nl.tudelft.simulation.jstats.streams.RandomNumberGenerator
      extended by nl.tudelft.simulation.jstats.streams.MersenneTwister
All Implemented Interfaces:
Serializable, StreamInterface

public class MersenneTwister
extends RandomNumberGenerator

A java implementation of the Mersenne Twister pseudo random number generator.

This is a Java version of the C-program for MT19937: Integer version. genrand() generates one pseudorandom unsigned integer (32bit) which is uniformly distributed among 0 to 2^32-1 for each call. sgenrand(seed) set initial values to the working area of 624 words. (seed is any 32-bit integer except for 0).

Orignally Coded by Takuji Nishimura, considering the suggestions by Topher Cooper and Marc Rieffel in July-Aug. 1997. More information can be found at http://www.math.keio.ac.jp/matumoto/emt.html .

Makoto Matsumoto and Takuji Nishimura, the original authors ask "When you use this, send an email to: matumoto@math.keio.ac.jp with an appropriate reference to your work" You might also point out this was a translation.

(c) copyright 2004 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: Lesser General Public License (LGPL) , no warranty.

Since:
1.0
Version:
$Revision: 1.1 $ $Date: 2007/01/06 13:25:41 $
Author:
Peter Jacobs
See Also:
Serialized Form

Field Summary
 
Fields inherited from class nl.tudelft.simulation.jstats.streams.RandomNumberGenerator
seed
 
Constructor Summary
MersenneTwister()
          constructs a new Mersenne Twister.
MersenneTwister(long seed)
          Constructor using a given seed.
 
Method Summary
protected  long next(int bits)
          returns the next value in the stream.
 void setSeed(long seed)
          sets the seed of the generator
 
Methods inherited from class nl.tudelft.simulation.jstats.streams.RandomNumberGenerator
getSeed, nextBoolean, nextDouble, nextFloat, nextInt, nextInt, nextLong, reset, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MersenneTwister

public MersenneTwister()
constructs a new Mersenne Twister. System.currentTimeMillis() is used as seed value.


MersenneTwister

public MersenneTwister(long seed)
Constructor using a given seed.

Parameters:
seed - The initial seed.
Method Detail

next

protected long next(int bits)
Description copied from class: RandomNumberGenerator
returns the next value in the stream.

Specified by:
next in class RandomNumberGenerator
Parameters:
bits - the number of bits used
Returns:
the next value.
See Also:
RandomNumberGenerator.next(int)

setSeed

public void setSeed(long seed)
Description copied from interface: StreamInterface
sets the seed of the generator

Specified by:
setSeed in interface StreamInterface
Specified by:
setSeed in class RandomNumberGenerator
Parameters:
seed - the new seed
See Also:
StreamInterface.setSeed(long)


Copyright © 2002-2011 Delft University of Technology, the Netherlands. All Rights Reserved.