sp_random.cpp File Reference

Evaluating random variables. More...

#include "sp_random.h"
#include <cmath>

Go to the source code of this file.

Namespaces

 faudes
 libFAUDES resides within the namespace faudes.
 

Macros

#define MODULUS   2147483647 /* DON'T CHANGE THIS VALUE */
 
#define MULTIPLIER   48271 /* DON'T CHANGE THIS VALUE */
 
#define CHECK   399268537 /* DON'T CHANGE THIS VALUE */
 
#define STREAMS   256 /* # of streams, DON'T CHANGE THIS VALUE */
 
#define A256   22925 /* jump multiplier, DON'T CHANGE THIS VALUE */
 
#define DEFAULT   123456789 /* initial seed, use 0 < DEFAULT < MODULUS */
 

Functions

void faudes::ran_plant_seeds (long x)
 Use this function to set the state of all the random number generator streams by "planting" a sequence of states (seeds), one per stream, with all states dictated by the state of the default stream. More...
 
void faudes::ran_put_seed (long seed)
 Put a seed. More...
 
void faudes::ran_select_stream (int index)
 Use this function to set the current random number generator stream – that stream from which the next random number will come. More...
 
void faudes::ran_init (long seed)
 Initialize random generator. More...
 
double faudes::ran (void)
 Run random generator Random Number Generator (for more details see "Random Number Generators: Good Ones Are Hard To Find" Steve Park and Keith Miller Communications of the ACM, October 1988) More...
 
double faudes::ran_uniform (double a, double b)
 Sample a random variable uniformly on interval [a;b) Distribution: f(t) dt= {1/(b-a)} dt for t, a <=t< b, else 0. More...
 
long faudes::ran_uniform_int (long a, long b)
 Sample a discrete random variable uniformly on interval [a;b) Distribution: p(n) = 1/(b-a-1) More...
 
double faudes::ran_exponential (double mu)
 Sample a random variable exponentially Distribution: f(t) dt = 1/mu exp(-t/mu) dt for t>=0. More...
 
double faudes::ran_exponential (double mu, Time::Type tossLB, Time::Type tossUB)
 Sample a random variable exponentially on a restricted interval Distribution: f(t) dt = 1/mu exp(-t/mu) dt for t>=0. More...
 
double faudes::ran_gauss (double mu, double sigma, Time::Type tossLB, Time::Type tossUB)
 Sample a random variable gaussian distributed on a restricted interval Distribution: f(t) = 1 / sqrt(2 pi sigma^2) * exp( -1/2 ((t-mu)/sigma)^2) for t>=0. More...
 
double faudes::ran_gaussian_cdf_P (double x)
 Help function: calculate gaussian CDF using an approximation from Abromowitz and Stegun: Handbook of Mathematical Functions. More...
 

Variables

static long faudes::ran_seed [STREAMS] = {DEFAULT}
 
static int faudes::ran_stream = 0
 
static int faudes::ran_initialized = 0
 

Detailed Description

Evaluating random variables.

Definition in file sp_random.cpp.

Macro Definition Documentation

◆ A256

#define A256   22925 /* jump multiplier, DON'T CHANGE THIS VALUE */

Definition at line 26 of file sp_random.cpp.

◆ CHECK

#define CHECK   399268537 /* DON'T CHANGE THIS VALUE */

Definition at line 24 of file sp_random.cpp.

◆ DEFAULT

#define DEFAULT   123456789 /* initial seed, use 0 < DEFAULT < MODULUS */

Definition at line 27 of file sp_random.cpp.

◆ MODULUS

#define MODULUS   2147483647 /* DON'T CHANGE THIS VALUE */

Definition at line 22 of file sp_random.cpp.

◆ MULTIPLIER

#define MULTIPLIER   48271 /* DON'T CHANGE THIS VALUE */

Definition at line 23 of file sp_random.cpp.

◆ STREAMS

#define STREAMS   256 /* # of streams, DON'T CHANGE THIS VALUE */

Definition at line 25 of file sp_random.cpp.

libFAUDES 2.32f --- 2024.12.22 --- c++ api documentaion by doxygen