Answers for "random number c++ range return"

C++
1

random number in a range c++

int random(int min, int max) {
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> gen(min, max);
    int a = gen(rng);
    return a;
}
Posted by: Guest on April-28-2022

Browse Popular Code Answers by Language