gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool
threadsafe_rng.cpp File Reference

A threadsafe interface to the STL random number generators. More...

#include "gambit/Utils/threadsafe_rng.hpp"
#include "gambit/Utils/util_macros.hpp"
#include "gambit/Utils/standalone_error_handlers.hpp"
#include "gambit/Logs/logger.hpp"
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/tuple/to_seq.hpp>
Include dependency graph for threadsafe_rng.cpp:

Go to the source code of this file.

Namespaces

 Gambit
 TODO: see if we can use this one:
 

Macros

#define ALL_RNGS   (default_random_engine, minstd_rand, minstd_rand0, mt19937, mt19937_64, ranlux24_base, ranlux48_base, ranlux24, ranlux48, knuth_b)
 
#define MAKE_SPECIALISED_RNG(r, data, elem)
 
#define ENABLE_ALL_RNGS   BOOST_PP_SEQ_FOR_EACH(MAKE_SPECIALISED_RNG, , BOOST_PP_TUPLE_TO_SEQ(ALL_RNGS))
 

Detailed Description

A threadsafe interface to the STL random number generators.

The generator to use can be chosen in the ini/yaml file with option rng: name where name is one of the following: default_random_engine Default random engine minstd_rand Minimal Standard minstd_rand generator minstd_rand0 Minimal Standard minstd_rand0 generator mt19937 Mersenne Twister 19937 generator mt19937_64 Mersene Twister 19937 generator (64 bit) ranlux24_base Ranlux 24 base generator ranlux48_base Ranlux 48 base generator ranlux24 Ranlux 24 generator ranlux48 Ranlux 48 generator knuth_b Knuth-B generator


Authors (add name and date if you modify):

Author
Pat Scott (p.sco.nosp@m.tt@i.nosp@m.mperi.nosp@m.al.a.nosp@m.c.uk)
Date
2014 Dec

Definition in file threadsafe_rng.cpp.

Macro Definition Documentation

◆ ALL_RNGS

#define ALL_RNGS   (default_random_engine, minstd_rand, minstd_rand0, mt19937, mt19937_64, ranlux24_base, ranlux48_base, ranlux24, ranlux48, knuth_b)

Definition at line 50 of file threadsafe_rng.cpp.

◆ ENABLE_ALL_RNGS

#define ENABLE_ALL_RNGS   BOOST_PP_SEQ_FOR_EACH(MAKE_SPECIALISED_RNG, , BOOST_PP_TUPLE_TO_SEQ(ALL_RNGS))

Definition at line 57 of file threadsafe_rng.cpp.

Referenced by Gambit::Random::create_rng_engine().

◆ MAKE_SPECIALISED_RNG

#define MAKE_SPECIALISED_RNG (   r,
  data,
  elem 
)
Value:
else if (engine == STRINGIFY(elem)) \
{ \
static Utils::specialised_threadsafe_rng<elem> ultralocal_rng(seed); \
local_rng = &ultralocal_rng; \
}
#define STRINGIFY(X)
Definition: stringify.hpp:29

Definition at line 51 of file threadsafe_rng.cpp.