Internal library for generating pseudo-random numbers.
More...
#include <stdint.h>
#include <math.h>
Go to the source code of this file.
|
#define | RandomReal(State) ((double)ValPRNGl(&State) / (~0UL)) |
| Macro for random real generator complient to multi-threading. More...
|
|
#define | UniformNoise(State, Bound) (Bound * (2.0 * RandomReal(State) - 1.0)) |
| Macro for symmetric uniform random number generator complient to multi-threading. More...
|
|
#define | SpecificNoise(State, Bound) (1.0 + UniformNoise(State, Bound)) |
| Macro for specific noise function complient to multi-threading. More...
|
|
|
typedef unsigned char | uchar |
|
|
void | InitPRNG (uint64_t Seed, PRNGState *State) |
| Initialization of the PRNG using Splitmix64 from S. Vigna and D. Lemire. More...
|
|
uint32_t | ValPRNGi (PRNGState *State) |
| Generation of one pseudo-random int at a time using Lehmer64 RNG (D. Lemire version) More...
|
|
uint64_t | ValPRNGl (PRNGState *State) |
| Generation of one pseudo-random long int at a time using Lehmer64 RNG (D. Lemire version) More...
|
|
◆ RandomReal
#define RandomReal |
( |
|
State | ) |
((double)ValPRNGl(&State) / (~0UL)) |
The generated number is between 0 and 1
◆ SpecificNoise
#define SpecificNoise |
( |
|
State, |
|
|
|
Bound |
|
) |
| (1.0 + UniformNoise(State, Bound)) |
◆ UniformNoise
#define UniformNoise |
( |
|
State, |
|
|
|
Bound |
|
) |
| (Bound * (2.0 * RandomReal(State) - 1.0)) |
The generated number is between -Bound and Bound
◆ uchar
typedef unsigned char uchar |
◆ InitPRNG()
void InitPRNG |
( |
uint64_t |
Seed, |
|
|
PRNGState * |
State |
|
) |
| |
◆ ValPRNGi()
◆ ValPRNGl()