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