diff --git a/README.md b/README.md index 9088bb3..81f83cb 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,18 @@ This repo contains a list of utils that will probably need to be implimented for * llo::utils::generate_random, generate a random numerical value. ```cpp -template -auto generate_random() -> T +template, number_t>> +number_t generate_random_number(const number_t minimum, const number_t maximum) { - std::random_device rd; - std::mt19937 mt(rd()); - std::uniform_real_distribution dist(1.0, 10.0); - return dist(mt); + using uniform_distribution_t = std::conditional_t, std::uniform_int_distribution, std::uniform_real_distribution<>>; + + std::random_device random_device; + + auto mt = std::mt19937{ random_device() }; + + auto uniform_distribution = uniform_distribution_t{ minimum, maximum }; + + return uniform_distribution(mt); } ```