Print a random number Between 1 and 75 inclusive
#include <random>
#include <iostream>
int main()
{
// Create a random device and use it to generate a random seed
std::random_device myRandomDevice;
unsigned seed = myRandomDevice();
// Initialize a default_random_engine with the seed
std::default_random_engine myRandomEngine(seed);
// Initialize a uniform_int_distribution to produce values between 1 and 75
std::uniform_int_distribution<int> myUnifIntDist(1, 75);
std::cout << myUnifIntDist(myRandomEngine) << " " << std::endl;
return 0;
}
Comments
Leave a comment