1 | /* |
2 | A C-program for MT19937-64 (2004/9/29 version). |
3 | Coded by Takuji Nishimura and Makoto Matsumoto. |
4 | |
5 | This is a 64-bit version of Mersenne Twister pseudorandom number |
6 | generator. |
7 | |
8 | Before using, initialize the state by using init_genrand64(seed) |
9 | or init_by_array64(init_key, key_length). |
10 | |
11 | Copyright (C) 2004, Makoto Matsumoto and Takuji Nishimura, |
12 | All rights reserved. |
13 | |
14 | Redistribution and use in source and binary forms, with or without |
15 | modification, are permitted provided that the following conditions |
16 | are met: |
17 | |
18 | 1. Redistributions of source code must retain the above copyright |
19 | notice, this list of conditions and the following disclaimer. |
20 | |
21 | 2. Redistributions in binary form must reproduce the above copyright |
22 | notice, this list of conditions and the following disclaimer in the |
23 | documentation and/or other materials provided with the distribution. |
24 | |
25 | 3. The names of its contributors may not be used to endorse or promote |
26 | products derived from this software without specific prior written |
27 | permission. |
28 | |
29 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
30 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
31 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
32 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
33 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
34 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
35 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
36 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
37 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
38 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
39 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
40 | |
41 | References: |
42 | T. Nishimura, ``Tables of 64-bit Mersenne Twisters'' |
43 | ACM Transactions on Modeling and |
44 | Computer Simulation 10. (2000) 348--357. |
45 | M. Matsumoto and T. Nishimura, |
46 | ``Mersenne Twister: a 623-dimensionally equidistributed |
47 | uniform pseudorandom number generator'' |
48 | ACM Transactions on Modeling and |
49 | Computer Simulation 8. (Jan. 1998) 3--30. |
50 | |
51 | Any feedback is very welcome. |
52 | http://www.math.hiroshima-u.ac.jp/~m-mat/MT/emt.html |
53 | email: m-mat @ math.sci.hiroshima-u.ac.jp (remove spaces) |
54 | */ |
55 | |
56 | #ifndef __MT19937_64_H |
57 | #define __MT19937_64_H |
58 | |
59 | /* initializes mt[NN] with a seed */ |
60 | void init_genrand64(unsigned long long seed); |
61 | |
62 | /* initialize by an array with array-length */ |
63 | /* init_key is the array for initializing keys */ |
64 | /* key_length is its length */ |
65 | void init_by_array64(unsigned long long init_key[], |
66 | unsigned long long key_length); |
67 | |
68 | /* generates a random number on [0, 2^64-1]-interval */ |
69 | unsigned long long genrand64_int64(void); |
70 | |
71 | |
72 | /* generates a random number on [0, 2^63-1]-interval */ |
73 | long long genrand64_int63(void); |
74 | |
75 | /* generates a random number on [0,1]-real-interval */ |
76 | double genrand64_real1(void); |
77 | |
78 | /* generates a random number on [0,1)-real-interval */ |
79 | double genrand64_real2(void); |
80 | |
81 | /* generates a random number on (0,1)-real-interval */ |
82 | double genrand64_real3(void); |
83 | |
84 | /* generates a random number on (0,1]-real-interval */ |
85 | double genrand64_real4(void); |
86 | |
87 | #endif |
88 | |