Mersenne Twister pseudo-RNG code. More...
#include <stdio.h>
#include "mt19937ar.h"
Go to the source code of this file.
Defines | |
#define | MT_N 624 |
#define | MT_M 397 |
#define | MT_MATRIX_A 0x9908b0dfUL |
#define | MT_UPPER_MASK 0x80000000UL |
#define | MT_LOWER_MASK 0x7fffffffUL |
Functions | |
static void | init_genrand (unsigned long s) |
static unsigned long | genrand_int32 (void) |
static double | genrand_res53 (void) |
void | mt_init_genrand (unsigned long s) |
initializes the generator with a seed | |
double | mt_genrand_res53 (void) |
generates a random number on [0,1) with 53-bit resolution | |
Variables | |
static unsigned long | mt [MT_N] |
static int | mti = MT_N + 1 |
char | _mt19937ar_tag [] = "using mt19937ar " MT19937AR_VERSION |
Mersenne Twister pseudo-RNG code.
This is the original code by Takuji Nishimura and Makoto Matsumoto, amended to keep only the parts used. Source : http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
Definition in file mt19937ar.c.
#define MT_LOWER_MASK 0x7fffffffUL |
least significant r bits
Definition at line 41 of file mt19937ar.c.
#define MT_M 397 |
Definition at line 38 of file mt19937ar.c.
#define MT_MATRIX_A 0x9908b0dfUL |
constant vector a
Definition at line 39 of file mt19937ar.c.
#define MT_N 624 |
Definition at line 37 of file mt19937ar.c.
#define MT_UPPER_MASK 0x80000000UL |
most significant w-r bits
Definition at line 40 of file mt19937ar.c.
static unsigned long genrand_int32 | ( | void | ) | [static] |
generates a random number on [0,0xffffffff]-interval
Definition at line 66 of file mt19937ar.c.
static double genrand_res53 | ( | void | ) | [static] |
generates a random number on [0,1) with 53-bit resolution
Definition at line 105 of file mt19937ar.c.
static void init_genrand | ( | unsigned long | s | ) | [static] |
initializes mt[MT_N] with a seed
Definition at line 50 of file mt19937ar.c.
double mt_genrand_res53 | ( | void | ) |
generates a random number on [0,1) with 53-bit resolution
Definition at line 149 of file mt19937ar.c.
void mt_init_genrand | ( | unsigned long | s | ) |
initializes the generator with a seed
Definition at line 141 of file mt19937ar.c.
char _mt19937ar_tag[] = "using mt19937ar " MT19937AR_VERSION |
Definition at line 136 of file mt19937ar.c.
unsigned long mt[MT_N] [static] |
the array for the state vector
Definition at line 43 of file mt19937ar.c.
int mti = MT_N + 1 [static] |
mti==MT_N+1 means mt[MT_N] is not initialized
Definition at line 44 of file mt19937ar.c.