Is there any way to reliably generate random integeres that are greater than the standard 64 bit long long supported by C++? I tried using this with the boost library but it won't compile:
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<cpp_int> dis(a, b); //a is 2 and b is a random cpp_int of arbitrary precision, usually very large (atleast 128 or more bits)
cpp_int e = dis(gen);
The error says,
Error C2338 invalid template argument for uniform_int_distribution: N4659 29.6.1.1 [rand.req.genl]/1e requires one of short, int, long, long long, unsigned short, unsigned int, unsigned long, or unsigned long long
I'm still wrapping my head around the whole boost library and I understand this is a trivial question. I would prefer to use one of the random number generators that the boost library has to offer, but there are SO many of them and I evidently don't know how to use them. Any and all help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire