csnip  0.1
rng_mt.h
Go to the documentation of this file.
1 #ifndef CSNIP_RNG_MT_H
2 #define CSNIP_RNG_MT_H
3 
11 #include <stdint.h>
12 
13 #include <csnip/rng.h>
14 
16 #define CSNIP_RNG_MT_N 624
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
23 typedef struct {
25  uint32_t state[CSNIP_RNG_MT_N];
26 
28  uint32_t* next;
30 
33 
36  int nseed,
37  const uint32_t* seed);
38 
41 
42 #ifdef __cplusplus
43 }
44 #endif
45 
48 #endif /* CSNIP_RNG_MT_H */
49 
50 #if defined(CSNIP_SHORT_NAMES) && !defined(CSNIP_RNG_MT_HAVE_SHORT_NAMES)
51 #define rng_mt_state csnip_rng_mt_state
52 #define rng_mt_makerng csnip_rng_mt_makerng
53 #define rng_mt_seed csnip_rng_mt_seed
54 #define rng_mt_getnum csnip_rng_mt_getnum
55 #define CSNIP_RNG_MT_HAVE_SHORT_NAMES
56 #endif /* CSNIP_SHORT_NAMES && !CSNIP_RNG_MT_HAVE_SHORT_NAMES */
#define CSNIP_RNG_MT_N
State array size.
Definition: rng_mt.h:16
void csnip_rng_mt_seed(csnip_rng_mt_state *S, int nseed, const uint32_t *seed)
Seed the MT Random number generator.
csnip_rng csnip_rng_mt_makerng(csnip_rng_mt_state *state)
Initialize a generic RNG descriptor.
Definition: rng_mt.c:27
uint32_t csnip_rng_mt_getnum(csnip_rng_mt_state *S)
Produce the next output number.
Definition: rng_mt.c:80
Method table for a random number generator.
Definition: rng.h:12
State of the Mersenne twister.
Definition: rng_mt.h:23
uint32_t * next
State position.
Definition: rng_mt.h:28