I am using GNU Scientific Library to generate random number. Random Number Generation — GSL 2.7 documentation
In general, we should get a gsl_rng
firstly.
const gsl_rng_type * T;
gsl_rng * r;
int i, n = 10;
gsl_rng_env_setup();
T = gsl_rng_default;
r = gsl_rng_alloc (T);
But should we use one gsl_rng
in one program?
According to the documentation (https://www.gnu.org/software/gsl/doc/html/rng.html, the first paragraph)
Each instance of a generator keeps track of its own state, allowing the generators to be used in multi-threaded programs.
This implies that you can have as many instances of gsl_rng
as you wish.