QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Macros | Functions | Variables
mersenne-twister.cpp File Reference
#include <stdio.h>
#include "mersenne-twister.h"
Include dependency graph for mersenne-twister.cpp:

Go to the source code of this file.

Macros

#define L31(x)   (0x7FFFFFFF & x)
 
#define M32(x)   (0x80000000 & x)
 
#define MD_UINT32_MAX   std::numeric_limits<uint32_t>::max()
 
#define ODD(x)   (x & 1)
 
#define UNROLL(expr)
 

Functions

static void generate_numbers ()
 
int mt_rand ()
 
void mt_srand (unsigned value)
 
uint32_t rand_u32 ()
 
uint64_t rand_u64 ()
 
double randd_cc ()
 
double randd_co ()
 
double randd_oo ()
 
float randf_cc ()
 
float randf_co ()
 
float randf_oo ()
 
void seed (uint32_t value)
 

Variables

static const unsigned DIFF = SIZE - PERIOD
 
static unsigned index = 0
 
static uint32_t MT [SIZE]
 
static const unsigned PERIOD = 397
 
static const unsigned SIZE = 624
 

Macro Definition Documentation

◆ L31

#define L31 (   x)    (0x7FFFFFFF & x)

Definition at line 39 of file mersenne-twister.cpp.

◆ M32

#define M32 (   x)    (0x80000000 & x)

Definition at line 38 of file mersenne-twister.cpp.

◆ MD_UINT32_MAX

#define MD_UINT32_MAX   std::numeric_limits<uint32_t>::max()

Definition at line 47 of file mersenne-twister.cpp.

◆ ODD

#define ODD (   x)    (x & 1)

Definition at line 40 of file mersenne-twister.cpp.

◆ UNROLL

#define UNROLL (   expr)
Value:
y = M32(MT[i]) | L31(MT[i+1]); \
MT[i] = MT[expr] ^ (y>>1) ^ MATRIX[ODD(y)]; \
++i;
#define M32(x)
static uint32_t MT[SIZE]
#define L31(x)
#define ODD(x)

Definition at line 42 of file mersenne-twister.cpp.

Function Documentation

◆ generate_numbers()

static void generate_numbers ( )
inlinestatic

Definition at line 49 of file mersenne-twister.cpp.

◆ mt_rand()

int mt_rand ( )

Definition at line 171 of file mersenne-twister.cpp.

◆ mt_srand()

void mt_srand ( unsigned  value)

Definition at line 191 of file mersenne-twister.cpp.

◆ rand_u32()

uint32_t rand_u32 ( )

Definition at line 152 of file mersenne-twister.cpp.

◆ rand_u64()

uint64_t rand_u64 ( )

Definition at line 226 of file mersenne-twister.cpp.

◆ randd_cc()

double randd_cc ( )

Definition at line 211 of file mersenne-twister.cpp.

◆ randd_co()

double randd_co ( )

Definition at line 216 of file mersenne-twister.cpp.

◆ randd_oo()

double randd_oo ( )

Definition at line 221 of file mersenne-twister.cpp.

◆ randf_cc()

float randf_cc ( )

Definition at line 196 of file mersenne-twister.cpp.

◆ randf_co()

float randf_co ( )

Definition at line 201 of file mersenne-twister.cpp.

◆ randf_oo()

float randf_oo ( )

Definition at line 206 of file mersenne-twister.cpp.

◆ seed()

void seed ( uint32_t  value)

Definition at line 111 of file mersenne-twister.cpp.

Variable Documentation

◆ DIFF

const unsigned DIFF = SIZE - PERIOD
static

Definition at line 33 of file mersenne-twister.cpp.

◆ index

unsigned index = 0
static

Definition at line 36 of file mersenne-twister.cpp.

◆ MT

uint32_t MT[SIZE]
static

Definition at line 35 of file mersenne-twister.cpp.

◆ PERIOD

const unsigned PERIOD = 397
static

Definition at line 32 of file mersenne-twister.cpp.

◆ SIZE

const unsigned SIZE = 624
static

Definition at line 31 of file mersenne-twister.cpp.