ProteoWizard
mt19937ar.h
Go to the documentation of this file.
1 /* $Id: mt19937ar.h 1814 2010-02-16 22:52:44Z chambm $
2 
3  A C-program for MT19937, with initialization improved 2002/1/26.
4  Coded by Takuji Nishimura and Makoto Matsumoto.
5 
6  Before using, initialize the state by using init_genrand(seed)
7  or init_by_array(init_key, key_length).
8 
9  Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
10  All rights reserved.
11  Copyright (C) 2005, Mutsuo Saito
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 
42  Any feedback is very welcome.
43  http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
44  email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
45 */
46 
47 /* initializes mt[N] with a seed */
48 void init_genrand(unsigned long s);
49 
50 /* initialize by an array with array-length */
51 /* init_key is the array for initializing keys */
52 /* key_length is its length */
53 /* slight change for C++, 2004/2/26 */
54 void init_by_array(unsigned long init_key[], int key_length);
55 
56 /* generates a random number on [0,0xffffffff]-interval */
57 unsigned long genrand_int32(void);
58 
59 /* generates a random number on [0,0x7fffffff]-interval */
60 long genrand_int31(void);
61 
62 /* These real versions are due to Isaku Wada, 2002/01/09 added */
63 /* generates a random number on [0,1]-real-interval */
64 double genrand_real1(void);
65 
66 /* generates a random number on [0,1)-real-interval */
67 double genrand_real2(void);
68 
69 /* generates a random number on (0,1)-real-interval */
70 double genrand_real3(void);
71 
72 /* generates a random number on [0,1) with 53-bit resolution*/
73 double genrand_res53(void);