OLD | NEW |
1 /* | 1 /* |
2 A C-program for MT19937, with initialization improved 2002/1/26. | 2 A C-program for MT19937, with initialization improved 2002/1/26. |
3 Coded by Takuji Nishimura and Makoto Matsumoto. | 3 Coded by Takuji Nishimura and Makoto Matsumoto. |
4 | 4 |
5 Before using, initialize the state by using init_genrand(seed) | 5 Before using, initialize the state by using init_genrand(seed) |
6 or init_by_array(init_key, key_length). | 6 or init_by_array(init_key, key_length). |
7 | 7 |
8 Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, | 8 Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, |
9 All rights reserved. | 9 All rights reserved. |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 | 38 |
39 Any feedback is very welcome. | 39 Any feedback is very welcome. |
40 http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html | 40 http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html |
41 email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space) | 41 email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space) |
42 */ | 42 */ |
43 | 43 |
44 #ifndef THIRD_PARTY_MT19937AR_MT19937AR_H_ | 44 #ifndef THIRD_PARTY_MT19937AR_MT19937AR_H_ |
45 #define THIRD_PARTY_MT19937AR_MT19937AR_H_ | 45 #define THIRD_PARTY_MT19937AR_MT19937AR_H_ |
46 | 46 |
| 47 #include <stdint.h> |
| 48 |
47 #include <vector> | 49 #include <vector> |
48 | 50 |
49 #include "base/basictypes.h" | |
50 | |
51 class MersenneTwister { | 51 class MersenneTwister { |
52 public: | 52 public: |
53 MersenneTwister(); | 53 MersenneTwister(); |
54 ~MersenneTwister(); | 54 ~MersenneTwister(); |
55 | 55 |
56 void init_genrand(uint32 s); | 56 void init_genrand(uint32_t s); |
57 void init_by_array(uint32 init_key[], int key_length); | 57 void init_by_array(uint32_t init_key[], int key_length); |
58 uint32 genrand_int32(void); | 58 uint32_t genrand_int32(void); |
59 | 59 |
60 private: | 60 private: |
61 std::vector<uint32> mt; /* the array for the state vector */ | 61 std::vector<uint32_t> mt; /* the array for the state vector */ |
62 int mti; /* mti==N+1 means mt[N] is not initialized */ | 62 int mti; /* mti==N+1 means mt[N] is not initialized */ |
63 }; | 63 }; |
64 | 64 |
65 #endif // THIRD_PARTY_MT19937AR_MT19937AR_H_ | 65 #endif // THIRD_PARTY_MT19937AR_MT19937AR_H_ |
OLD | NEW |