Debian Codegraph @

external/gsl/gsl_rng__fishman18.c

raw symbols SCIP
1 /* rng/fishman18.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 "Fishman - Moore III".
29 *
30 * This implementation copyright (C) 2001 Carlo Perassi
31 * and (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 #include "gsl_rng__schrage.c"cxx . . $ `<file>/external/gsl/gsl_rng__schrage.c`/
39
40 #define AAcxx . . $ `external/gsl/gsl_rng__fishman18.c:40:9`! 62089911UL
41 #define MMcxx . . $ `external/gsl/gsl_rng__fishman18.c:41:9`! 0x7fffffffUL /* 2 ^ 31 - 1 */
42 #define CEIL_SQRT_MMcxx . . $ `external/gsl/gsl_rng__fishman18.c:42:9`! 46341UL /* ceil(sqrt(2 ^ 31 - 1)) */
43
44 static inline unsigned long int ran_getcxx . . $ ran_get(751e5d26f8574c32). (void *vstate);
45 static double ran_get_doublecxx . . $ ran_get_double(a405b17f82753acc). (void *vstate);
46 static void ran_setcxx . . $ ran_set(5500c4293b1bbef0). (void *state, unsigned long int s);
47
48 typedef structcxx . . $ $anonymous_type_2b6a7a71cd882ba5_0#
49 {
50 unsigned long int xcxx . . $ $anonymous_type_2b6a7a71cd882ba5_0#x.;
51 }
52 ran_state_tcxx . . $ ran_state_t#;
53
54 static inline unsigned long int
55 ran_getcxx . . $ ran_get(751e5d26f8574c32). (void *vstate)
56 {
57 ran_state_tcxx . . $ ran_state_t# *state = (ran_state_tcxx . . $ ran_state_t# *) vstate;
58
59 state->xcxx . . $ $anonymous_type_2b6a7a71cd882ba5_0#x. = schrage_multcxx . . $ schrage_mult(8f424044f20ee7cf). (AAcxx . . $ `external/gsl/gsl_rng__fishman18.c:40:9`!, state->xcxx . . $ $anonymous_type_2b6a7a71cd882ba5_0#x., MMcxx . . $ `external/gsl/gsl_rng__fishman18.c:41:9`!, CEIL_SQRT_MMcxx . . $ `external/gsl/gsl_rng__fishman18.c:42:9`!);
60
61 return state->xcxx . . $ $anonymous_type_2b6a7a71cd882ba5_0#x.;
62 }
63
64 static double
65 ran_get_doublecxx . . $ ran_get_double(a405b17f82753acc). (void *vstate)
66 {
67 ran_state_tcxx . . $ ran_state_t# *state = (ran_state_tcxx . . $ ran_state_t# *) vstate;
68
69 return ran_getcxx . . $ ran_get(751e5d26f8574c32). (state) / 2147483647.0;
70 }
71
72 static void
73 ran_setcxx . . $ ran_set(5500c4293b1bbef0). (void *vstate, unsigned long int s)
74 {
75 ran_state_tcxx . . $ ran_state_t# *state = (ran_state_tcxx . . $ ran_state_t# *) vstate;
76
77 if ((s % MMcxx . . $ `external/gsl/gsl_rng__fishman18.c:41:9`!) == 0)
78 s = 1; /* default seed is 1 */
79
80 state->xcxx . . $ $anonymous_type_2b6a7a71cd882ba5_0#x. = s % MMcxx . . $ `external/gsl/gsl_rng__fishman18.c:41:9`!;
81
82 return;
83 }
84
85 static const gsl_rng_typecxx . . $ gsl_rng_type# ran_typecxx . . $ ran_type. = {
86 "fishman18", /* name */
87 MMcxx . . $ `external/gsl/gsl_rng__fishman18.c:41:9`! - 1, /* RAND_MAX */
88 1, /* RAND_MIN */
89 sizeof (ran_state_tcxx . . $ ran_state_t#),
90 &ran_setcxx . . $ ran_set(5500c4293b1bbef0).,
91 &ran_getcxx . . $ ran_get(751e5d26f8574c32).,
92 &ran_get_doublecxx . . $ ran_get_double(a405b17f82753acc).
93 };
94
95 const gsl_rng_typecxx . . $ gsl_rng_type# *gsl_rng_fishman18cxx . . $ gsl_rng_fishman18. = &ran_typecxx . . $ ran_type.;