mas01mc@292
|
1 This is a Mersenne Twister pseudorandom number generator
|
mas01mc@292
|
2 with period 2^19937-1 with improved initialization scheme,
|
mas01mc@292
|
3 modified on 2002/1/26 by Takuji Nishimura and Makoto Matsumoto.
|
mas01mc@292
|
4 modified on 2005/4/26 by Mutsuo Saito
|
mas01mc@292
|
5
|
mas01mc@292
|
6 Contents of this tar ball:
|
mas01mc@292
|
7 readme-mt.txt this file
|
mas01mc@292
|
8 mt19937ar.c the C source (ar: initialize by ARray)
|
mas01mc@292
|
9 mt19937ar.h the C header file for mt19937ar
|
mas01mc@292
|
10 mtTest.c the C test main program of mt19937ar.c
|
mas01mc@292
|
11 mt19937ar.out Test outputs of six types generators. 1000 for each
|
mas01mc@292
|
12
|
mas01mc@292
|
13 1. Initialization
|
mas01mc@292
|
14 The initialization scheme for the previous versions of MT
|
mas01mc@292
|
15 (e.g. 1999/10/28 version or earlier) has a tiny problem, that
|
mas01mc@292
|
16 the most significant bits of the seed is not well reflected
|
mas01mc@292
|
17 to the state vector of MT.
|
mas01mc@292
|
18
|
mas01mc@292
|
19 This version (2002/1/26) has two initialization schemes:
|
mas01mc@292
|
20 init_genrand(seed) and init_by_array(init_key, key_length).
|
mas01mc@292
|
21
|
mas01mc@292
|
22 init_genrand(seed) initializes the state vector by using
|
mas01mc@292
|
23 one unsigned 32-bit integer "seed", which may be zero.
|
mas01mc@292
|
24
|
mas01mc@292
|
25 init_by_array(init_key, key_length) initializes the state vector
|
mas01mc@292
|
26 by using an array init_key[] of unsigned 32-bit integers
|
mas01mc@292
|
27 of length key_kength. If key_length is smaller than 624,
|
mas01mc@292
|
28 then each array of 32-bit integers gives distinct initial
|
mas01mc@292
|
29 state vector. This is useful if you want a larger seed space
|
mas01mc@292
|
30 than 32-bit word.
|
mas01mc@292
|
31
|
mas01mc@292
|
32 2. Generation
|
mas01mc@292
|
33 After initialization, the following type of pseudorandom numbers
|
mas01mc@292
|
34 are available.
|
mas01mc@292
|
35
|
mas01mc@292
|
36 genrand_int32() generates unsigned 32-bit integers.
|
mas01mc@292
|
37 genrand_int31() generates unsigned 31-bit integers.
|
mas01mc@292
|
38 genrand_real1() generates uniform real in [0,1] (32-bit resolution).
|
mas01mc@292
|
39 genrand_real2() generates uniform real in [0,1) (32-bit resolution).
|
mas01mc@292
|
40 genrand_real3() generates uniform real in (0,1) (32-bit resolution).
|
mas01mc@292
|
41 genrand_res53() generates uniform real in [0,1) with 53-bit resolution.
|
mas01mc@292
|
42
|
mas01mc@292
|
43 Note: the last five functions call the first one.
|
mas01mc@292
|
44 if you need more speed for these five functions, you may
|
mas01mc@292
|
45 suppress the function call by copying genrand_int32() and
|
mas01mc@292
|
46 replacing the last return(), following to these five functions.
|
mas01mc@292
|
47
|
mas01mc@292
|
48 3. main()
|
mas01mc@292
|
49 main() is an example to initialize with an array of length 4,
|
mas01mc@292
|
50 then 1000 outputs of unsigned 32-bit integers,
|
mas01mc@292
|
51 then 1000 outputs of real [0,1) numbers.
|
mas01mc@292
|
52
|
mas01mc@292
|
53 4. The outputs
|
mas01mc@292
|
54 The output of the mt19937ar.c is in the file mt19937ar.out.
|
mas01mc@292
|
55 If you revise or translate the code, check the output
|
mas01mc@292
|
56 by using this file.
|
mas01mc@292
|
57
|
mas01mc@292
|
58 5. Cryptography
|
mas01mc@292
|
59 This generator is not cryptoraphically secure.
|
mas01mc@292
|
60 You need to use a one-way (or hash) function to obtain
|
mas01mc@292
|
61 a secure random sequence.
|
mas01mc@292
|
62
|
mas01mc@292
|
63 6. Correspondence
|
mas01mc@292
|
64 See:
|
mas01mc@292
|
65 URL http://www.math.keio.ac.jp/matumoto/emt.html
|
mas01mc@292
|
66 email matumoto@math.keio.ac.jp, nisimura@sci.kj.yamagata-u.ac.jp
|
mas01mc@292
|
67
|
mas01mc@292
|
68 7. Reference
|
mas01mc@292
|
69 M. Matsumoto and T. Nishimura,
|
mas01mc@292
|
70 "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform
|
mas01mc@292
|
71 Pseudo-Random Number Generator",
|
mas01mc@292
|
72 ACM Transactions on Modeling and Computer Simulation,
|
mas01mc@292
|
73 Vol. 8, No. 1, January 1998, pp 3--30.
|
mas01mc@292
|
74
|
mas01mc@292
|
75 -------
|
mas01mc@292
|
76 Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
|
mas01mc@292
|
77 All rights reserved.
|
mas01mc@292
|
78 Copyright (C) 2005, Mutsuo Saito
|
mas01mc@292
|
79 All rights reserved.
|