29#include <boost/preprocessor/control/if.hpp>
30#include <boost/preprocessor/seq.hpp>
31#include <boost/random/lagged_fibonacci.hpp>
32#include <boost/random/mersenne_twister.hpp>
33#include <boost/random/ranlux.hpp>
34#include <boost/random/uniform_real.hpp>
35#include <boost/random/variate_generator.hpp>
36#include <fmt/format.h>
37#include <nda/macros.hpp>
46 (mt19937)(mt11213b)( \
47 lagged_fibonacci607)(lagged_fibonacci1279)(lagged_fibonacci2281)(lagged_fibonacci3217)(lagged_fibonacci4423)(lagged_fibonacci9689)(lagged_fibonacci19937)(lagged_fibonacci23209)(lagged_fibonacci44497)(ranlux3)
49namespace triqs::mc_tools {
52 initialize_rng(name_, seed);
56 void random_generator::initialize_rng(std::string
const &name, std::uint32_t seed) {
59 using rng_t = RandomGenerators::RandMT;
60 ptr_ = std::make_unique<rng_model<rng_t>>(seed);
65#define DRNG(r, data, XX) \
66 if (name == AS_STRING(XX)) { \
67 using rng_t = boost::variate_generator<boost::XX, boost::uniform_real<double>>; \
68 ptr_ = std::make_unique<rng_model<rng_t>>(rng_t{boost::XX{seed}, boost::uniform_real<>{}}); \
71 BOOST_PP_SEQ_FOR_EACH(DRNG, ~, RNG_LIST)
74 throw std::runtime_error(fmt::format(
"Error in random_generator::initialize_rng: RNG with name {} is not supported",
name));
78#define PR(r, sep, p, XX) BOOST_PP_IF(p, +(sep) +, ) std::string(AS_STRING(XX))
79 return BOOST_PP_SEQ_FOR_EACH_I(PR, sep, RNG_LIST);
83 std::vector<std::string> res;
84#define PR2(r, sep, p, XX) res.push_back(AS_STRING(XX));
85 BOOST_PP_SEQ_FOR_EACH_I(PR2, sep, RNG_LIST);
Provides a Mersenne Twister random number generator.
Compiler / platform glue and the dcomplex alias (must be included before any Boost header).
std::string random_generator_names(std::string const &sep)
Get a string containing the names of all available RNGs.
std::vector< std::string > random_generator_names_list()
Get a list of all available RNG names.
Provides a type erased random number generator.