org.jscience.measure.random
Class MersenneTwisterGenerator

java.lang.Object
  extended by org.jscience.measure.random.RandomElement
      extended by org.jscience.measure.random.RandomSeedable
          extended by org.jscience.measure.random.MersenneTwisterGenerator
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, RandomGenerator

public class MersenneTwisterGenerator
extends RandomSeedable
implements java.io.Serializable

Mersenne Twister -- advanced psuedorandom generator with a period of 219937-1

Source code is available.

This class is derived from Sean Luke's implementation

License

Copyright (c) 2003 by Paul Houle.
Derived from a work copyright (c) 2003 by Sean Luke.
Portions copyright (c) 1993 by Michael Lecuyer.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

See Also:
Serialized Form

Constructor Summary
MersenneTwisterGenerator()
          Creates a new RanMT object.
MersenneTwisterGenerator(java.util.Date d)
          Creates a new RanMT object.
MersenneTwisterGenerator(int[] array)
          If a 32 bit seed isn't enough for you, you can pass an array of 624 integers.
MersenneTwisterGenerator(long seed)
           
 
Method Summary
 double nextDouble()
          DOCUMENT ME!
 
Methods inherited from class org.jscience.measure.random.RandomSeedable
ClockSeed, ClockSeed
 
Methods inherited from class org.jscience.measure.random.RandomElement
choose, choose, clone, coin, coin, gaussian, gaussian, nextDouble, nextDouble, powlaw, uniform
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MersenneTwisterGenerator

public MersenneTwisterGenerator()
Creates a new RanMT object.


MersenneTwisterGenerator

public MersenneTwisterGenerator(long seed)

MersenneTwisterGenerator

public MersenneTwisterGenerator(java.util.Date d)
Creates a new RanMT object.

Parameters:
d - DOCUMENT ME!

MersenneTwisterGenerator

public MersenneTwisterGenerator(int[] array)
If a 32 bit seed isn't enough for you, you can pass an array of 624 integers. Any array of integers is fine so long as they aren't all zero.

Method Detail

nextDouble

public final double nextDouble()
DOCUMENT ME!

Specified by:
nextDouble in interface RandomGenerator
Returns:
DOCUMENT ME!