Debian Codegraph @

external/gsl/gsl_rng__lecuyer21.c

raw symbols SCIP
1 /* rng/lecuyer21.c
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 3 of the License, or (at
6 * your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 */
17
18 /*
19 * This generator is taken from
20 *
21 * Donald E. Knuth
22 * The Art of Computer Programming
23 * Volume 2
24 * Third Edition
25 * Addison-Wesley
26 * Page 108
27 *
28 * This implementation copyright (C) 2001 Brian Gough, Carlo Perassi
29 * and (C) 2003 Heiko Bauke.
30 */
31
32 #include "gsl__config.h"cxx . . $ `<file>/external/gsl/gsl__config.h`/
33 #include <stdlib.h>
34 #include "gsl_rng.h"cxx . . $ `<file>/external/gsl/gsl_rng.h`/
35
36 #define AAAcxx . . $ `external/gsl/gsl_rng__lecuyer21.c:36:9`! 40692
37 #define MMMcxx . . $ `external/gsl/gsl_rng__lecuyer21.c:37:9`! 2147483399UL
38 #define QQQcxx . . $ `external/gsl/gsl_rng__lecuyer21.c:38:9`! 52774
39 #define RRRcxx . . $ `external/gsl/gsl_rng__lecuyer21.c:39:9`! 3791
40
41 static inline unsigned long int ran_getcxx . . $ ran_get(751e5d26f8574c32). (void *vstate);
42 static double ran_get_doublecxx . . $ ran_get_double(a405b17f82753acc). (void *vstate);
43 static void ran_setcxx . . $ ran_set(5500c4293b1bbef0). (void *state, unsigned long int s);
44
45 typedef structcxx . . $ $anonymous_type_1c9afca58bd4a43c_0#
46 {
47 unsigned long int xcxx . . $ $anonymous_type_1c9afca58bd4a43c_0#x.;
48 }
49 ran_state_tcxx . . $ ran_state_t#;
50
51 static inline unsigned long int
52 ran_getcxx . . $ ran_get(751e5d26f8574c32). (void *vstate)
53 {
54 ran_state_tcxx . . $ ran_state_t# *state = (ran_state_tcxx . . $ ran_state_t# *) vstate;
55
56 long int y = state->xcxx . . $ $anonymous_type_1c9afca58bd4a43c_0#x.;
57 long int r = RRRcxx . . $ `external/gsl/gsl_rng__lecuyer21.c:39:9`! * (y / QQQcxx . . $ `external/gsl/gsl_rng__lecuyer21.c:38:9`!);
58
59 y = AAAcxx . . $ `external/gsl/gsl_rng__lecuyer21.c:36:9`! * (y % QQQcxx . . $ `external/gsl/gsl_rng__lecuyer21.c:38:9`!) - r;
60 if (y < 0)
61 y += MMMcxx . . $ `external/gsl/gsl_rng__lecuyer21.c:37:9`!;
62
63 state->xcxx . . $ $anonymous_type_1c9afca58bd4a43c_0#x. = y;
64
65 return state->xcxx . . $ $anonymous_type_1c9afca58bd4a43c_0#x.;
66 }
67
68 static double
69 ran_get_doublecxx . . $ ran_get_double(a405b17f82753acc). (void *vstate)
70 {
71 ran_state_tcxx . . $ ran_state_t# *state = (ran_state_tcxx . . $ ran_state_t# *) vstate;
72
73 return ran_getcxx . . $ ran_get(751e5d26f8574c32). (state) / 2147483399.0;
74 }
75
76 static void
77 ran_setcxx . . $ ran_set(5500c4293b1bbef0). (void *vstate, unsigned long int s)
78 {
79 ran_state_tcxx . . $ ran_state_t# *state = (ran_state_tcxx . . $ ran_state_t# *) vstate;
80
81 if ((s%MMMcxx . . $ `external/gsl/gsl_rng__lecuyer21.c:37:9`!) == 0)
82 s = 1; /* default seed is 1 */
83
84 state->xcxx . . $ $anonymous_type_1c9afca58bd4a43c_0#x. = s % MMMcxx . . $ `external/gsl/gsl_rng__lecuyer21.c:37:9`!;
85
86 return;
87 }
88
89 static const gsl_rng_typecxx . . $ gsl_rng_type# ran_typecxx . . $ ran_type. = {
90 "lecuyer21", /* name */
91 MMMcxx . . $ `external/gsl/gsl_rng__lecuyer21.c:37:9`!-1, /* RAND_MAX */
92 1, /* RAND_MIN */
93 sizeof (ran_state_tcxx . . $ ran_state_t#),
94 &ran_setcxx . . $ ran_set(5500c4293b1bbef0).,
95 &ran_getcxx . . $ ran_get(751e5d26f8574c32).,
96 &ran_get_doublecxx . . $ ran_get_double(a405b17f82753acc).
97 };
98
99 const gsl_rng_typecxx . . $ gsl_rng_type# *gsl_rng_lecuyer21cxx . . $ gsl_rng_lecuyer21. = &ran_typecxx . . $ ran_type.;