On this answer, there is a minimal example of using boost::multiprecision
with boost::random
.
I'm struggling with that example when I use a seed:
#include <boost/multiprecision/random.hpp>
#include <boost/random.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/number.hpp>
int main() {
namespace mp = boost::multiprecision;
boost::uniform_01<mp::cpp_dec_float_50> uf;
boost::random::independent_bits_engine<boost::mt19937, 50L * 1000L / 301L, mp::number<mp::cpp_int::backend_type, mp::et_off> > gen;
gen.seed(1); // commenting this line compiles
std::cout << std::setprecision(50);
for (unsigned i = 0; i < 10; ++i) {
std::cout << uf(gen) << std::endl;
}
return 0;
}
which fails to compile with the error
/boost/random/detail/seed_impl.hpp:271:9: No member named 'generate' in
'boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<
0, 0, 1, 0, std::__1::allocator<unsigned long long> >, 0>'
Does anyone knows why this is the case and how can I set a seed to the generator?