ROOT-Sim core  3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
Functions | Variables
random.c File Reference

Random Number Generators. More...

#include <lib/random/random.h>
#include <core/core.h>
#include <core/intrinsics.h>
#include <lib/random/xoroshiro.h>
#include <lib/random/xxtea.h>
#include <lp/lp.h>
#include <math.h>
Include dependency graph for random.c:

Functions

void random_lib_lp_init (lp_id_t lp_id, struct rng_ctx *rng_ctx)
 Initialize the rollbackable RNG library of the current LP.
 
uint64_t RandomU64 (void)
 Return a random 64-bit value. More...
 
double Random (void)
 Return a random value in [0,1] according to a uniform distribution. More...
 
double Normal (void)
 Return a pair of independent random numbers according to a Standard Normal Distribution. More...
 
int RandomRange (int min, int max)
 
int RandomRangeNonUniform (int x, int min, int max)
 
double Gamma (unsigned ia)
 Return a number in according to a Gamma Distribution of Integer Order ia Corresponds to the waiting time to the ia-th event in a Poisson process of unit mean. More...
 
double Poisson (void)
 Return a random number according to an Exponential distribution with unit mean Corresponds to the waiting time to the next event in a Poisson process of unit mean. More...
 
unsigned Zipf (double skew, unsigned limit)
 Return a random sample from a Zipf distribution Based on the rejection method by Luc Devroye for sampling: "Non-Uniform Random Variate Generation, page 550, Springer-Verlag, 1986. More...
 

Variables

static const uint32_t xxtea_seeding_key [4]
 

Detailed Description

Random Number Generators.

Piece-Wise Deterministic Random Number Generators.

Function Documentation

◆ Gamma()

double Gamma ( unsigned  ia)

Return a number in according to a Gamma Distribution of Integer Order ia Corresponds to the waiting time to the ia-th event in a Poisson process of unit mean.

Author
D. E. Knuth
Parameters
iaInteger Order of the Gamma Distribution
Returns
A random number

◆ Normal()

double Normal ( void  )

Return a pair of independent random numbers according to a Standard Normal Distribution.

Returns
A pair of random numbers

◆ Poisson()

double Poisson ( void  )

Return a random number according to an Exponential distribution with unit mean Corresponds to the waiting time to the next event in a Poisson process of unit mean.

Returns
A random number

◆ Random()

double Random ( void  )

Return a random value in [0,1] according to a uniform distribution.

Returns
The random number

◆ RandomU64()

uint64_t RandomU64 ( void  )

Return a random 64-bit value.

Returns
The random number

◆ Zipf()

unsigned Zipf ( double  skew,
unsigned  limit 
)

Return a random sample from a Zipf distribution Based on the rejection method by Luc Devroye for sampling: "Non-Uniform Random Variate Generation, page 550, Springer-Verlag, 1986.

Parameters
skewThe skew of the distribution
limitThe largest sample to retrieve
Returns
A random number

Variable Documentation

◆ xxtea_seeding_key

const uint32_t xxtea_seeding_key[4]
static
Initial value:
= {UINT32_C(0xd0a8f58a), UINT32_C(0x33359424), UINT32_C(0x09baa55b),
UINT32_C(0x80e1bdb0)}