/search.css" rel="stylesheet" type="text/css"/>
/search.js">
- random123-1.11.2pre Documentation
Go to the documentation of this file.
32 #ifndef __r123_compat_gslrng_dot_h__
33 #define __r123_compat_gslrng_dot_h__
35 #include <gsl/gsl_rng.h>
67 #define GSL_CBRNG(NAME, CBRNGNAME) \
68 const gsl_rng_type *gsl_rng_##NAME; \
71 CBRNGNAME##_ctr_t ctr; \
72 CBRNGNAME##_ctr_t r; \
73 CBRNGNAME##_key_t key; \
77 static unsigned long int NAME##_get(void *vstate){ \
78 NAME##_state *st = (NAME##_state *)vstate; \
79 const int N=sizeof(st->ctr.v)/sizeof(st->ctr.v[0]); \
80 if( st->elem == 0 ){ \
82 if( N>1 && st->ctr.v[0] == 0 ) ++st->ctr.v[1]; \
83 if( N>2 && st->ctr.v[1] == 0 ) ++st->ctr.v[2]; \
84 if( N>3 && st->ctr.v[2] == 0 ) ++st->ctr.v[3]; \
85 st->r = CBRNGNAME(st->ctr, st->key); \
88 return 0xffffffffUL & st->r.v[--st->elem]; \
92 NAME##_get_double (void * vstate) \
94 return NAME##_get (vstate)/4294967296.0; \
97 static void NAME##_set(void *vstate, unsigned long int s){ \
98 NAME##_state *st = (NAME##_state *)vstate; \
104 memset(&st->ctr.v[0], 0, sizeof(st->ctr.v)); \
105 memset(&st->key.v[0], 0, sizeof(st->key.v)); \
115 static const gsl_rng_type NAME##_type = { \
119 sizeof(NAME##_state), \
125 const gsl_rng_type *gsl_rng_##NAME = &NAME##_type