xs/sandy_rng.h

filter: Statementstmt 0.0% 0 / 8 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 10 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« xs/rng.c ↑ Summary lib/App/Sandy.pm »
1 #ifndef __GSL_RNG_H__
2 #define __GSL_RNG_H__
3  
4 #include <stdlib.h>
5  
6 /* From gsl_math.h */
7 #ifndef M_PI
8 # define M_PI 3.14159265358979323846264338328 /* pi */
9 #endif
10  
11 typedef struct
12 {
13 const char *name;
14 unsigned long int max;
15 unsigned long int min;
16 size_t size;
17 void (*set) (void *state, unsigned long int seed);
18 unsigned long int (*get) (void *state);
19 double (*get_double) (void *state);
20 }
21 gsl_rng_type;
22  
23 typedef struct
24 {
25 const gsl_rng_type * type;
26 void *state;
27 }
28 gsl_rng;
29  
30 extern const gsl_rng_type *gsl_rng_ranlxd2;
31  
32 gsl_rng *gsl_rng_alloc (const gsl_rng_type * T);
33 void gsl_rng_free (gsl_rng * r);
34  
35 void gsl_rng_set (const gsl_rng * r, unsigned long int seed);
36 unsigned long int gsl_rng_max (const gsl_rng * r);
37 unsigned long int gsl_rng_min (const gsl_rng * r);
38 const char *gsl_rng_name (const gsl_rng * r);
39  
40 size_t gsl_rng_size (const gsl_rng * r);
41 void * gsl_rng_state (const gsl_rng * r);
42  
43 static inline unsigned long int
44 0 gsl_rng_get (const gsl_rng * r)
45 {
46 0 return (r->type->get) (r->state);
47 }
48  
49 static inline double
50 0 gsl_rng_uniform (const gsl_rng * r)
51 {
52 0 return (r->type->get_double) (r->state);
53 }
54  
55 static inline double
56 0 gsl_rng_uniform_pos (const gsl_rng * r)
57 {
58 double x ;
59 do
60 {
61 0 x = (r->type->get_double) (r->state) ;
62 }
63 0 ▶ while (x == 0) ;
Branch: 1 branch
BranchTrueFalseTotal
while (x == 0) ; 0 0 0
64  
65 0 return x ;
66 }
67  
68 double gsl_ran_gaussian (const gsl_rng * r, const double sigma);
69 double gsl_ran_gaussian_ratio_method (const gsl_rng * r, const double sigma);
70 double gsl_ran_gaussian_pdf (const double x, const double sigma);
71 double gsl_ran_ugaussian (const gsl_rng * r);
72 double gsl_ran_ugaussian_ratio_method (const gsl_rng * r);
73 double gsl_ran_ugaussian_pdf (const double x);
74  
75 #endif /* __GSL_RNG_H__ */
« xs/rng.c ↑ Summary lib/App/Sandy.pm »