BEEP-8 Helper Lib 1.0.0
|
Header file for the Mersenne Twister random number generator. More...
#include <stdint.h>
Go to the source code of this file.
Functions | |
void | init_genrand (unsigned long s) |
Initializes the state of the Mersenne Twister with a seed. | |
void | init_by_array (unsigned long init_key[], int key_length) |
Initializes the state of the Mersenne Twister with an array. | |
uint32_t | genrand_int32 (void) |
Generates a random number on [0, 0xffffffff] interval. | |
int32_t | genrand_int31 (void) |
Generates a random number on [0, 0x7fffffff] interval. | |
int32_t | genrand_min_max (int min_, int max_) |
Generates a random number in the specified range [min_, max_]. | |
Header file for the Mersenne Twister random number generator.
This header file declares functions for initializing and generating random numbers using the Mersenne Twister algorithm (MT19937). The implementation is based on the original code by Takuji Nishimura and Makoto Matsumoto.
The Mersenne Twister is a pseudorandom number generator that is widely used due to its high period (2^19937-1) and good statistical properties.
This implementation is not thread-safe. For multithreaded applications, ensure that each thread has its own instance of the Mersenne Twister state.
Before generating random numbers, initialize the state using either init_genrand
or init_by_array
.
|
extern |
Generates a random number on [0, 0x7fffffff] interval.
This function generates a 31-bit random number in the range [0, 0x7fffffff].
|
extern |
Generates a random number on [0, 0xffffffff] interval.
This function generates a 32-bit random number in the range [0, 0xffffffff].
|
extern |
Generates a random number in the specified range [min_, max_].
This function generates a random number in the inclusive range [min_, max_].
min_ | The minimum value of the range. |
max_ | The maximum value of the range. |
|
extern |
Initializes the state of the Mersenne Twister with an array.
This function initializes the internal state array using an array of seeds.
init_key | The array of seed values. |
key_length | The length of the seed array. |
|
extern |
Initializes the state of the Mersenne Twister with a seed.
This function initializes the internal state array with a seed.
s | The seed value. |