#include <random> //Random stuff
#include <ctime> //std::time
#include <iostream>

int rand_num(int from, int to)
{
    //Static is needed to seed our prng only once
    //and all function calls will share generator
    static std::mt19937 rg(std::time(nullptr));
    //distribution is recreated each call because function might be called with different parameters
    std::uniform_int_distribution<> dis(from,  to);
    return dis(rg); //return result of generation
}

int main()
{
    for(int i =0; i < 20; ++i)
        std::cout << rand_num(1, 100) << '\n';
}