The ROme OpTimistic Simulator  3.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
random.c File Reference

Random Number Generators. More...

#include <lib/random/random.h>
#include <core/intrinsics.h>
#include <lib/lib_internal.h>
#include <lib/random/xoroshiro.h>
#include <math.h>
#include <memory.h>
+ Include dependency graph for random.c:

Go to the source code of this file.

Functions

void random_lib_lp_init (void)
 
double Random (void)
 
uint64_t RandomU64 (void)
 
double Expent (double mean)
 
double Normal (void)
 
int RandomRange (int min, int max)
 
int RandomRangeNonUniform (int x, int min, int max)
 
double Gamma (unsigned ia)
 
double Poisson (void)
 
unsigned Zipf (double skew, unsigned limit)
 

Detailed Description

Random Number Generators.

Piece-Wise Deterministic Random Number Generators.

Definition in file random.c.

Function Documentation

◆ Expent()

double Expent ( double  mean)

Return a random number according to an Exponential distribution. The mean value of the distribution must be passed as the mean value.

Parameters
meanMean value of the distribution
Returns
A random number

Definition at line 61 of file random.c.

◆ Gamma()

double Gamma ( unsigned  ia)

Return a number in according to a Gamma Distribution of Integer Order ia, a 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

Definition at line 118 of file random.c.

◆ Normal()

double Normal ( void  )

Return a random number according to a Standard Normal Distribution

Returns
A random number

Definition at line 74 of file random.c.

◆ Poisson()

double Poisson ( void  )

Return the waiting time to the next event in a Poisson process of unit mean.

Returns
A random number

Definition at line 162 of file random.c.

◆ 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

Definition at line 176 of file random.c.