TPCCLIB
|
normally distributed (Gaussian) deviate with zero mean and unit variance. More...
#include "libtpcmodel.h"
Go to the source code of this file.
Macros | |
#define | RAND_MAX 32767 |
Functions | |
double | gaussdev () |
unsigned int | drandSeed (short int seed) |
Make and optionally set the seed for rand(), drand, drandRange, and drandGaussian(). | |
void | init_gaussdev () |
double | gaussdev2 () |
double | drand () |
int | rand_range (int nr, double *d, double low, double up, int type) |
Variables | |
long int | GAUSSDEV_SEED |
normally distributed (Gaussian) deviate with zero mean and unit variance.
Definition in file gaussdev.c.
#define RAND_MAX 32767 |
Max number for rand()
Definition at line 13 of file gaussdev.c.
Referenced by bootstrap(), drand(), and random_shuffle().
double drand | ( | ) |
Alternative function to rand() which returns a double precision floating point number in the range of [0,1].
Definition at line 142 of file gaussdev.c.
Referenced by gaussdev(), gaussdev2(), rand_range(), tgoRandomParameters(), and tgoRandomParametersST().
unsigned int drandSeed | ( | short int | seed | ) |
Make and optionally set the seed for rand(), drand, drandRange, and drandGaussian().
Uses microseconds from the computer clock and process ID to reduce the chance of getting the same seed for simultaneously executing program threads and instances.
seed | Also sets seed with srand (1) or not (0) |
Definition at line 63 of file gaussdev.c.
Referenced by tgo().
double gaussdev | ( | ) |
Applies the polar form of Box-Müller transform to produce pseudo-random numbers with Gaussian (normal) distribution which has a zero mean and standard deviation of one. Box GEP, Muller ME. A note on the generation of random normal deviates. Annals of Mathematical Statistics, Volume 29, Issue 2, 1958, 610-611. Available from JSTOR https://www.jstor.org/
Definition at line 30 of file gaussdev.c.
double gaussdev2 | ( | ) |
Applies the polar form of Box-Müller transform to produce pseudo-random numbers with Gaussian (normal) distribution which has a zero mean and standard deviation of one. This function does never set seed, like gaussdev() does, therefore set seed for random number generator before first calling this routine, for example with srand(time(NULL));
Box GEP, Muller ME. A note on the generation of random normal deviates. Annals of Mathematical Statistics, Volume 29, Issue 2, 1958, 610-611. Available from JSTOR https://www.jstor.org/
Definition at line 112 of file gaussdev.c.
void init_gaussdev | ( | ) |
Initiate random number generator for gaussdev()
Definition at line 92 of file gaussdev.c.
Referenced by gaussdev().
int rand_range | ( | int | nr, |
double * | d, | ||
double | low, | ||
double | up, | ||
int | type ) |
Fills the double array with random numbers between specified limits. Set seed for random number generator before calling this routine, for example with srand(time(NULL));
nr | Nr of values in double array |
d | Pointer to allocated double array |
low | Lower limit for random values |
up | Upper limit for random values |
type | Distribution: 0=even, 1=square-root transformation |
Definition at line 159 of file gaussdev.c.
long int GAUSSDEV_SEED |
Seed for random number generator
Definition at line 7 of file gaussdev.c.
Referenced by init_gaussdev().