Tscope5
|
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 int max) |
void | ts5_random_list (const int nmax, const int freq, int *list) |
Random doubles | |
Tscope5 also gives acces to random numbers drawn from some common distributions: | |
double | ts5_random_uniform () |
double | ts5_random_normal (double mu, double sigma) |
double | ts5_random_exponential (double mu) |
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 int seed) |
Definition in file randomizer.c.
unsigned long int ts5_random_integer | ( | const unsigned int | max | ) |
Draw an integer from a uniform distribution.
max | Number of possible values of the random integer. |
Definition at line 34 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 50 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 82 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 99 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 115 of file randomizer.c.
unsigned long int ts5_seed_randomizer | ( | const unsigned 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 142 of file randomizer.c.