====== C - C++ Random Numbers ====== ===== random_number.hpp ===== #pragma once #include int random_int_number(int min, int max); double random_double_number(double min, double max); ---- ===== random_number.cpp ===== #include "random_number.hpp" std::random_device r; std::default_random_engine rnd(r()); int random_int_number(int min, int max) { return std::uniform_int_distribution(min, max)(rnd); } double random_double_number(double min, double max) { return std::uniform_real_distribution(min, max)(rnd); } ---- ===== References ===== https://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution https://en.cppreference.com/w/cpp/numeric/random/uniform_real_distribution