PartMC
2.6.1
|
Wrapper routines for GSL random number functions. More...
Go to the source code of this file.
Macros | |
#define | PMC_RAND_GSL_SUCCESS 0 |
Result code indicating successful completion. More... | |
#define | PMC_RAND_GSL_INIT_FAIL 1 |
Result code indicating initialization failure. More... | |
#define | PMC_RAND_GSL_NOT_INIT 2 |
Result code indicating the generator was not initialized when it should have been. More... | |
#define | PMC_RAND_GSL_ALREADY_INIT 3 |
Result code indicating the generator was already initialized when an initialization was attempted. More... | |
Functions | |
int | pmc_srand_gsl (int seed) |
Initialize the random number generator with the given seed. More... | |
int | pmc_rand_finalize_gsl () |
Cleanup and deallocate the random number generator. More... | |
int | pmc_rand_gsl (double *harvest) |
Generate a uniform random number in . More... | |
int | pmc_rand_int_gsl (int n, int *harvest) |
Generate a uniform random integer in . More... | |
int | pmc_rand_normal_gsl (double mean, double stddev, double *harvest) |
Generate a normally-distributed random number. More... | |
int | pmc_rand_poisson_gsl (double mean, int *harvest) |
Generate a Poisson-distributed random integer. More... | |
int | pmc_rand_binomial_gsl (int n, double p, int *harvest) |
Generate a Binomial-distributed random integer. More... | |
Variables | |
static gsl_rng * | pmc_rand_gsl_rng = NULL |
Private internal-use variable to store the random number generator. More... | |
Wrapper routines for GSL random number functions.
Definition in file rand_gsl.c.
#define PMC_RAND_GSL_ALREADY_INIT 3 |
Result code indicating the generator was already initialized when an initialization was attempted.
Definition at line 34 of file rand_gsl.c.
#define PMC_RAND_GSL_INIT_FAIL 1 |
Result code indicating initialization failure.
Definition at line 26 of file rand_gsl.c.
#define PMC_RAND_GSL_NOT_INIT 2 |
Result code indicating the generator was not initialized when it should have been.
Definition at line 30 of file rand_gsl.c.
#define PMC_RAND_GSL_SUCCESS 0 |
Result code indicating successful completion.
Definition at line 23 of file rand_gsl.c.
int pmc_rand_binomial_gsl | ( | int | n, |
double | p, | ||
int * | harvest | ||
) |
Generate a Binomial-distributed random integer.
n | The sample size for the distribution. |
p | The sample probability for the distribution. |
harvest | A pointer to the generated random number. |
Definition at line 142 of file rand_gsl.c.
int pmc_rand_finalize_gsl | ( | ) |
Cleanup and deallocate the random number generator.
This must be called after pmc_srand_gsl().
Definition at line 65 of file rand_gsl.c.
int pmc_rand_gsl | ( | double * | harvest | ) |
Generate a uniform random number in .
harvest | A pointer to the generated random number. |
Definition at line 80 of file rand_gsl.c.
int pmc_rand_int_gsl | ( | int | n, |
int * | harvest | ||
) |
Generate a uniform random integer in .
n | The upper limit of the random integer. |
harvest | A pointer to the generated random number. |
Definition at line 95 of file rand_gsl.c.
int pmc_rand_normal_gsl | ( | double | mean, |
double | stddev, | ||
double * | harvest | ||
) |
Generate a normally-distributed random number.
mean | The mean of the distribution. |
stddev | The standard deviation of the distribution. |
harvest | A pointer to the generated random number. |
Definition at line 111 of file rand_gsl.c.
int pmc_rand_poisson_gsl | ( | double | mean, |
int * | harvest | ||
) |
Generate a Poisson-distributed random integer.
mean | The mean of the distribution. |
harvest | A pointer to the generated random number. |
Definition at line 126 of file rand_gsl.c.
int pmc_srand_gsl | ( | int | seed | ) |
Initialize the random number generator with the given seed.
This must be called before any other GSL random number functions are called.
seed | The random seed to use. |
Definition at line 45 of file rand_gsl.c.
|
static |
Private internal-use variable to store the random number generator.
Definition at line 19 of file rand_gsl.c.