I am writing a class that samples from a specific known probability distribution. Since the quality of random number generators can vary, I want my class to be templated on the user's choice of random engine. I want to use the concept std::uniform_random_bit_generator
to do that. So my class will take an object t
of type T
where T
is an std::uniform_random_bit_generator
. I then want to sample from my distribution by using the output of invoking t
(using calculus).
The problem I am running into is that I don't understand from the definition of std::uniform_random_bit_generator
what the output of invoking t
is and how I should use that output in the most general way. If I knew, for instance, that t
would always return an integer between t::min()
and t::max()
, then I would be able to finish my class. However, invoking t
could return a double or some other type that is non-trivial to work with.
How should I sample from a distribution using an object t
of type T
that satisfies the general concept std::uniform_random_bit_generator
?