Debian Codegraph @

external/gsl/gsl_rng__borosh13.c

raw symbols SCIP
1 /* rng/borosh13.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 106-108
27 *
28 * It is called "Borosh - Niederreiter"
29 *
30 * This implementation copyright (C) 2001 Carlo Perassi and
31 * (C) 2003 Heiko Bauke.
32 */
33
34 #include "gsl__config.h"cxx . . $ `<file>/external/gsl/gsl__config.h`/
35 #include <stdlib.h>
36 #include "gsl_rng.h"cxx . . $ `<file>/external/gsl/gsl_rng.h`/
37
38 #define AAcxx . . $ `external/gsl/gsl_rng__borosh13.c:38:9`! 1812433253UL
39 #define MMcxx . . $ `external/gsl/gsl_rng__borosh13.c:39:9`! 0xffffffffUL /* 2 ^ 32 - 1 */
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_44ea91baf951dc3c_0#
46 {
47 unsigned long int xcxx . . $ $anonymous_type_44ea91baf951dc3c_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 state->xcxx . . $ $anonymous_type_44ea91baf951dc3c_0#x. = (AAcxx . . $ `external/gsl/gsl_rng__borosh13.c:38:9`! * state->xcxx . . $ $anonymous_type_44ea91baf951dc3c_0#x.) & MMcxx . . $ `external/gsl/gsl_rng__borosh13.c:39:9`!;
57
58 return state->xcxx . . $ $anonymous_type_44ea91baf951dc3c_0#x.;
59 }
60
61 static double
62 ran_get_doublecxx . . $ ran_get_double(a405b17f82753acc). (void *vstate)
63 {
64 ran_state_tcxx . . $ ran_state_t# *state = (ran_state_tcxx . . $ ran_state_t# *) vstate;
65
66 return ran_getcxx . . $ ran_get(751e5d26f8574c32). (state) / 4294967296.0;
67 }
68
69 static void
70 ran_setcxx . . $ ran_set(5500c4293b1bbef0). (void *vstate, unsigned long int s)
71 {
72 ran_state_tcxx . . $ ran_state_t# *state = (ran_state_tcxx . . $ ran_state_t# *) vstate;
73
74 if (s == 0)
75 s = 1; /* default seed is 1 */
76
77 state->xcxx . . $ $anonymous_type_44ea91baf951dc3c_0#x. = s & MMcxx . . $ `external/gsl/gsl_rng__borosh13.c:39:9`!;
78
79 return;
80 }
81
82 static const gsl_rng_typecxx . . $ gsl_rng_type# ran_typecxx . . $ ran_type. = {
83 "borosh13", /* name */
84 MMcxx . . $ `external/gsl/gsl_rng__borosh13.c:39:9`!, /* RAND_MAX */
85 1, /* RAND_MIN */
86 sizeof (ran_state_tcxx . . $ ran_state_t#),
87 &ran_setcxx . . $ ran_set(5500c4293b1bbef0).,
88 &ran_getcxx . . $ ran_get(751e5d26f8574c32).,
89 &ran_get_doublecxx . . $ ran_get_double(a405b17f82753acc).
90 };
91
92 const gsl_rng_typecxx . . $ gsl_rng_type# *gsl_rng_borosh13cxx . . $ gsl_rng_borosh13. = &ran_typecxx . . $ ran_type.;