Function rng_set_seed (o2scl)

O2scl : Function List

void o2scl::rng_set_seed(rng<> &r, int mpi_size = 1, int mpi_rank = 0, int verbose = 1)

Set the RNG seed using an OpenMP critical block.

This function sets the random number seed for the given random number generator. If OpenMP support is included when O2scl is compiled, then the seed generation is enclosed in an OpenMP critical block to ensure that multiple threads do not get the same seed. This function uses the variable lib_settings_class::seed to store a global library seed.

When OpenMP is enabled, it is possible that this function could create a condition where no OpenMP thread can proceed and thus prevent subsequent code from running as normal, however, this is expected to be rare in practice.