Java Randomness Test Suite

JRandTest at SourceForge

com.fasteasytrade.JRandTest.Algo
Class MT19937Prng

java.lang.Object
  extended bycom.fasteasytrade.JRandTest.Algo.Cipher
      extended bycom.fasteasytrade.JRandTest.Algo.MT19937Prng

public class MT19937Prng
extends Cipher

MT19937Prng class java implements MT19937 prng.

Translated from C to java.

  A C-program for MT19937, with initialization improved 2002/1/26.
  Coded by Takuji Nishimura and Makoto Matsumoto.
 
  Before using, initialize the state by using init_genrand(seed)
  or init_by_array(init_key, key_length).
 
  Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
  All rights reserved.
 
  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions
  are met:
 
  1. Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
 
  2. Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.
 
  3. The names of its contributors may not be used to endorse or promote
  products derived from this software without specific prior written
  permission.
 
  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 OWNER 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.
 
 
  Any feedback is very welcome.
  http://www.math.sci.hiroshima-u.ac.jp/˜m-mat/MT19937Prng/emt.html
  email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
 


Field Summary
(package private)  long LOWER_MASK
           
(package private)  int M
           
(package private)  long[] mag01
           
(package private)  long MATRIX_A
           
(package private)  long[] mt
           
(package private)  int mti
           
(package private)  int N
           
(package private)  long UPPER_MASK
           
 
Constructor Summary
MT19937Prng()
           
 
Method Summary
(package private)  long genrand_int31()
          generates a random number on [0,0x7fffffff]-interval
(package private)  long genrand_int32()
          generates a random number on [0,0xffffffff]-interval
(package private)  double genrand_real1()
          generates a random number on [0,1]-real-interval These real versions are due to Isaku Wada, 2002/01/09 added
(package private)  double genrand_real2()
          generates a random number on [0,1)-real-interval These real versions are due to Isaku Wada, 2002/01/09 added
(package private)  double genrand_real3()
          generates a random number on (0,1)-real-interval These real versions are due to Isaku Wada, 2002/01/09 added
(package private)  double genrand_res53()
          generates a random number on [0,1) with 53-bit resolution These real versions are due to Isaku Wada, 2002/01/09 added
(package private)  void init_by_array(long[] init_key, int key_length)
          initialize by an array with array-length slight change for C++, 2004/2/26
(package private)  void init_genrand(long s)
          initializes mt[N] with a seed
static void main(String[] args)
          Test MT19937Prng PRNG
 
Methods inherited from class com.fasteasytrade.JRandTest.Algo.Cipher
compareBytes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

N

final int N
See Also:
Constant Field Values

M

final int M
See Also:
Constant Field Values

MATRIX_A

final long MATRIX_A
See Also:
Constant Field Values

UPPER_MASK

final long UPPER_MASK
See Also:
Constant Field Values

LOWER_MASK

final long LOWER_MASK
See Also:
Constant Field Values

mt

long[] mt

mti

int mti

mag01

long[] mag01
Constructor Detail

MT19937Prng

public MT19937Prng()
Method Detail

init_genrand

void init_genrand(long s)
initializes mt[N] with a seed


init_by_array

void init_by_array(long[] init_key,
                   int key_length)
initialize by an array with array-length

slight change for C++, 2004/2/26

Parameters:
init_key - is the array for initializing keys
key_length - is its length

genrand_int32

long genrand_int32()
generates a random number on [0,0xffffffff]-interval


genrand_int31

long genrand_int31()
generates a random number on [0,0x7fffffff]-interval


genrand_real1

double genrand_real1()
generates a random number on [0,1]-real-interval

These real versions are due to Isaku Wada, 2002/01/09 added


genrand_real2

double genrand_real2()
generates a random number on [0,1)-real-interval

These real versions are due to Isaku Wada, 2002/01/09 added


genrand_real3

double genrand_real3()
generates a random number on (0,1)-real-interval

These real versions are due to Isaku Wada, 2002/01/09 added


genrand_res53

double genrand_res53()
generates a random number on [0,1) with 53-bit resolution

These real versions are due to Isaku Wada, 2002/01/09 added


main

public static void main(String[] args)
Test MT19937Prng PRNG


Java Randomness Test Suite

JRandTest at SourceForge

JRandTest at SourceForge
Copyright © 2005 Zur Aougav. All Rights Reserved.