Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / third_party / mt19937ar / mt19937ar.h
blob31c6960c7caf1ed0742f6edbac69babf27c7b48d
1 /*
2 A C-program for MT19937, with initialization improved 2002/1/26.
3 Coded by Takuji Nishimura and Makoto Matsumoto.
5 Before using, initialize the state by using init_genrand(seed)
6 or init_by_array(init_key, key_length).
8 Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
9 All rights reserved.
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions
13 are met:
15 1. Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
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.
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.
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.
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)
44 #ifndef THIRD_PARTY_MT19937AR_MT19937AR_H_
45 #define THIRD_PARTY_MT19937AR_MT19937AR_H_
47 #include <vector>
49 #include "base/basictypes.h"
51 class MersenneTwister {
52 public:
53 MersenneTwister();
54 ~MersenneTwister();
56 void init_genrand(uint32 s);
57 void init_by_array(uint32 init_key[], int key_length);
58 uint32 genrand_int32(void);
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 */
65 #endif // THIRD_PARTY_MT19937AR_MT19937AR_H_