A quick note on generating random numbers in C++. I will just present how to use the gsl random number generator. See full details on the GSL help page.
First one need to do the overall initialization by doing:
const gsl_rng_type * rT;
gsl_rng * rgen;
rT = gsl_rng_default;
rgen = gsl_rng_alloc (rT);
Then here is how to use each particular random number generator:
discrete |
|
---|---|
binomial |
|
uniform |
|
uniform discrete |
|