std::random_device rd; std::mt19937 e{rd()}; // or std::default_random_engine e{rd()}; std::uniform_int_distribution<int> dist{1, 5}; // get random numbers with: dist(e);