xref: /netbsd-src/external/lgpl3/gmp/dist/rand/randmt.h (revision c3ab26950fe8540fb553d1d1dcae454bc98e5a25)
1 /* Mersenne Twister pseudo-random number generator defines.
2 
3 Copyright 2002, 2003 Free Software Foundation, Inc.
4 
5 This file is part of the GNU MP Library.
6 
7 The GNU MP Library is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The GNU MP Library is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15 License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License
18 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
19 
20 
21 /* Number of extractions used to warm the buffer up.  */
22 #define WARM_UP 2000
23 
24 /* Period parameters.  */
25 #define N 624
26 #define M 397
27 #define MATRIX_A 0x9908B0DF   /* Constant vector a.  */
28 
29 /* State structure for MT.  */
30 typedef struct
31 {
32   gmp_uint_least32_t mt[N];    /* State array.  */
33   int mti;                     /* Index of current value.  */
34 } gmp_rand_mt_struct;
35 
36 
37 void __gmp_mt_recalc_buffer (gmp_uint_least32_t *);
38 void __gmp_randget_mt (gmp_randstate_t, mp_ptr, unsigned long int);
39 void __gmp_randclear_mt (gmp_randstate_t);
40 void __gmp_randiset_mt (gmp_randstate_ptr, gmp_randstate_srcptr);
41