PLplot  5.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
mt19937ar.c File Reference
#include <stdio.h>
#include "mt19937ar.h"

Go to the source code of this file.

Macros

#define N   624
#define M   397
#define MATRIX_A   0x9908b0dfUL
#define UPPER_MASK   0x80000000UL
#define LOWER_MASK   0x7fffffffUL

Functions

void init_genrand (unsigned long s)
void init_by_array (unsigned long init_key[], int key_length)
unsigned long genrand_int32 (void)
long genrand_int31 (void)
double genrand_real1 (void)
double genrand_real2 (void)
double genrand_real3 (void)
double genrand_res53 (void)

Variables

static unsigned long mt [N]
static int mti = N + 1

Detailed Description

Mersenne twister random number generator.

Definition in file mt19937ar.c.

Macro Definition Documentation

#define LOWER_MASK   0x7fffffffUL

Definition at line 59 of file mt19937ar.c.

#define M   397

Definition at line 56 of file mt19937ar.c.

#define MATRIX_A   0x9908b0dfUL

Definition at line 57 of file mt19937ar.c.

#define N   624

Definition at line 55 of file mt19937ar.c.

#define UPPER_MASK   0x80000000UL

Definition at line 58 of file mt19937ar.c.

Function Documentation

long genrand_int31 ( void  )

generates a random number on [0,0x7fffffff]-interval

Returns
A random integer with 31-bit resolution.

Definition at line 172 of file mt19937ar.c.

unsigned long genrand_int32 ( void  )

generates a random number on [0,0xffffffff]-interval

Returns
A random integer with 32-bit resolution.

Definition at line 128 of file mt19937ar.c.

double genrand_real1 ( void  )

generates a random number on [0,1]-real-interval

Returns
A random number [0,1].

Definition at line 181 of file mt19937ar.c.

double genrand_real2 ( void  )

generates a random number on [0,1)-real-interval

Returns
A random number [0,1).

Definition at line 191 of file mt19937ar.c.

double genrand_real3 ( void  )

generates a random number on (0,1)-real-interval

Returns
A random number (0,1).

Definition at line 201 of file mt19937ar.c.

double genrand_res53 ( void  )

generates a random number on [0,1) with 53-bit resolution

Returns
A random numer [0,1) with 53-bit resolution.

Definition at line 211 of file mt19937ar.c.

void init_by_array ( unsigned long  init_key[],
int  key_length 
)

Initialize by an array with array-length Slight change for C++, 2004/2/26

Parameters
init_keyThe array for initializing keys
key_lengthLength of the array

Definition at line 90 of file mt19937ar.c.

void init_genrand ( unsigned long  s)

Initializes mt[N] with a seed

Parameters
sSeed value for the random number generator.

Definition at line 68 of file mt19937ar.c.

Variable Documentation

unsigned long mt[N]
static

Definition at line 61 of file mt19937ar.c.

int mti = N + 1
static

Definition at line 62 of file mt19937ar.c.