SiReNe Simulation Software  1.0
GenLib.c File Reference

Internal library for generating pseudo-random numbers. More...

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <math.h>
#include <sys/time.h>
#include "GenLib.h"
Include dependency graph for GenLib.c:

Functions

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...
 

Function Documentation

◆ InitPRNG()

void InitPRNG ( uint64_t  Seed,
PRNGState State 
)

Parameters
SeedInitialization value of the PRNG
StateInitialized state of the PRNG

References PRNGState::State.

Referenced by main(), and RandomConnections().

◆ ValPRNGi()

uint32_t ValPRNGi ( PRNGState State)

See also
https://lemire.me/blog/2019/03/19/the-fastest-conventional-random-number-generator-that-can-pass-big-crush
Parameters
StatePRNG state used to generate the next value
Returns
A pseudo-random unsigned int

References UnionPRNG::i, PRNGState::Index, UnionPRNG::l, PRNGState::State, and PRNGState::Value.

Referenced by RandomConnections().

◆ ValPRNGl()

uint64_t ValPRNGl ( PRNGState State)

See also
https://lemire.me/blog/2019/03/19/the-fastest-conventional-random-number-generator-that-can-pass-big-crush
Parameters
StatePRNG state used to generate the next value
Returns
A pseudo-random unsigned long int

References UnionPRNG::l, PRNGState::State, and PRNGState::Value.