I tweaked it a bit and created header-only/module interface files that you add one or the other to your project and get easy-to-use functionality like C's <cstdlib> srand/rand functions.
Now that I really take a look at the ctor notes at cppreference for std::uniform_real_distribution there is an additional check I probably should make for bad params:
72 73 74 75
if ( from >= to || ((from - to) > std::numeric_limits<double>::max()) )
{
throw std::invalid_argument("bad double distribution params");
}
Bad params are either in reversed order or equal, OR the params exceed the maximum finite value a double can hold. Do I read the ctor notes correctly and have the two test conditions correct?
I've been staring at this code for so long I need a fresh pair of eyes.
Admittedly this RTK isn't cryptographically robust, but that isn't the stated intent. I want to have something that makes using the <random> library as easy as using the C library functions. Either as a stand-alone header or module interface file.