Tscope5
|
Definitions of randomizer functions. More...
Go to the source code of this file.
Functions | |
Random integers | |
In an experiment most of the time you will need random integers, preferably drawn from a list without replacement: | |
unsigned long int | ts5_random_integer (const unsigned long int max) |
Draw an integer from a uniform distribution. More... | |
void | ts5_random_list (const int nmax, const int freq, int *list) |
Draw a list of random values without replacement. More... | |
Random doubles | |
Tscope5 also gives acces to random numbers drawn from some common distributions: | |
double | ts5_random_uniform () |
Draw a double from a uniform distribution. More... | |
double | ts5_random_normal (double mu, double sigma) |
Draw a double from a normal distribution. More... | |
double | ts5_random_exponential (double mu) |
Draw a double from an exponential distribution. More... | |
Set the random seed | |
If you do simulation work it is also possible to set the random seed yourself. Identical seeds always result in the same randomized list. | |
unsigned long int | ts5_seed_randomizer (const unsigned long int seed) |
Seed the randomizer subsystem. More... | |
Definitions of randomizer functions.
Definition in file randomizer.c.
unsigned long int ts5_random_integer | ( | const unsigned long int | max | ) |
Draw an integer from a uniform distribution.
max | Number of possible values of the random integer. |
Definition at line 42 of file randomizer.c.
void ts5_random_list | ( | const int | nmax, |
const int | freq, | ||
int * | list | ||
) |
Draw a list of random values without replacement.
nmax | Maximum value (output values will range from 0 to n-1). |
freq | Frequency of each value. |
list | Adress of the array where the list is stored. |
Definition at line 58 of file randomizer.c.
double ts5_random_uniform | ( | ) |
Draw a double from a uniform distribution.
The range includes 0.0 but excludes 1.0.
Definition at line 92 of file randomizer.c.
double ts5_random_normal | ( | double | mu, |
double | sigma | ||
) |
Draw a double from a normal distribution.
mu | Mean of the distribution. |
sigma | Standard deviation of the distribution. |
Definition at line 109 of file randomizer.c.
double ts5_random_exponential | ( | double | mu | ) |
Draw a double from an exponential distribution.
mu | Mean of the distribution. |
Definition at line 125 of file randomizer.c.
unsigned long int ts5_seed_randomizer | ( | const unsigned long int | seed | ) |
Seed the randomizer subsystem.
seed | Seed for the randomizer. |
If the generator is seeded with the same value of seed on two different runs, the same stream of random numbers will be generated by successive calls to the routines.
The timer is a good source for random seeds.
Definition at line 154 of file randomizer.c.