OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 A C-program for MT19937, with initialization improved 2002/1/26. | |
3 Coded by Takuji Nishimura and Makoto Matsumoto. | |
4 | |
5 Before using, initialize the state by using init_genrand(seed) | |
6 or init_by_array(init_key, key_length). | |
7 | |
8 Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, | |
9 All rights reserved. | |
10 | |
11 Redistribution and use in source and binary forms, with or without | |
12 modification, are permitted provided that the following conditions | |
13 are met: | |
14 | |
15 1. Redistributions of source code must retain the above copyright | |
16 notice, this list of conditions and the following disclaimer. | |
17 | |
18 2. Redistributions in binary form must reproduce the above copyright | |
19 notice, this list of conditions and the following disclaimer in the | |
20 documentation and/or other materials provided with the distribution. | |
21 | |
22 3. The names of its contributors may not be used to endorse or promote | |
23 products derived from this software without specific prior written | |
24 permission. | |
25 | |
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
30 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
31 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
32 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
33 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
34 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
35 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
36 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
37 | |
38 | |
39 Any feedback is very welcome. | |
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) | |
42 */ | |
43 | |
44 #ifndef THIRD_PARTY_MT19937AR_MT19937AR_H_ | |
45 #define THIRD_PARTY_MT19937AR_MT19937AR_H_ | |
46 | |
47 #include <vector> | |
48 | |
49 #include "base/basictypes.h" | |
50 | |
SteveT
2012/08/16 20:55:42
BTW, do we have to do any special documentation gi
Alexei Svitkine (slow)
2012/08/17 14:08:59
I'm not sure. Let's see what open-source-third-par
Ilya Sherman
2012/08/17 17:53:20
I think that edits are usually saved to a .patch f
| |
51 class MersenneTwister { | |
52 public: | |
53 MersenneTwister(); | |
54 ~MersenneTwister(); | |
55 | |
56 void init_genrand(uint32 s); | |
57 void init_by_array(uint32 init_key[], int key_length); | |
58 uint32 genrand_int32(void); | |
59 | |
60 private: | |
61 std::vector<uint32> mt; /* the array for the state vector */ | |
62 int mti; /* mti==N+1 means mt[N] is not initialized */ | |
63 }; | |
64 | |
65 #endif // THIRD_PARTY_MT19937AR_MT19937AR_H_ | |
OLD | NEW |