Template Class RandomNumberGenerator¶
Defined in File rng_utils.hpp
Class Documentation¶
-
template<typename
Type
>
classqhipster
::
RandomNumberGenerator
¶ Used to generate random numbers that are local to each rank, or common to the state or the complete pool.
The generation of numbers and the method to skip ahead are more efficient when MKL (and in particular VSL) is used.
Public Functions
-
RandomNumberGenerator
()¶
-
~RandomNumberGenerator
()¶
-
RandomNumberGenerator
(RandomNumberGenerator *source_rng)¶ Initialize RNG by copying the streams of the source RNG.
-
std::size_t
GetSeed
()¶ Get basic quantities.
-
std::size_t
GetNumGeneratedOrSkippedLocalNumbers
()¶
-
std::size_t
GetNumGeneratedOrSkippedStateNumbers
()¶
-
std::size_t
GetNumGeneratedOrSkippedPoolNumbers
()¶
-
void
SetSeedStreamPtrs
(std::size_t RNG_seed)¶ Set one different seed for each MPI rank (no MKL) or assign different streams (VSL).
-
void
SkipAhead
(std::size_t num_skip, std::string shared = "local")¶ Skip ahead.
-
void
UniformRandomNumbers
(Type *value, std::size_t size = 1UL, Type a = 0., Type b = 1., std::string shared = "local")¶ Generate random numbers in [a,b):
size indicates how many numbers
shared can be: local, state, pool
-
void
GaussianRandomNumbers
(Type *value, std::size_t size = 1UL, std::string shared = "local")¶ Generate random gaussian numbers (mean value = 0, std.dev = 1):
size indicates how many numbers
shared can be: local, state, pool
-
void
RandomIntegersInRange
(int *value, std::size_t size = 1UL, int a = 0, int b = 2, std::string shared = "local")¶ Generate random integers in [a,b), default being {0,1}..
size indicates how many numbers
shared can be: local, state, pool
-