#include <iostream>
#include <cstdlib>//for use of srand, to increase randomness
#include <ctime>//for use of time, to random seed
usingnamespace std;
int main()
{
srand(time(0));//Possibly random
cout<<"Randomly generating up to 20 'random' integers:"<<endl;
for(int i=0;i<rand()%20+1;i++)
cout<<rand()%100+1<<" ";
cout<<endl;
cout<<"Custom Exit: Press enter: ";
cin.get();
return 0;
}
Edit:
Other than that, the below provides the detail on <random>:
http://www.cplusplus.com/reference/random/
1 2 3 4 5 6 7 8 9 10 11 12
//------------------Setup----------------------------------------------;
//Pseudo-random number engine:
std::default_random_engine generator;
//http://www.cplusplus.com/reference/random/default_random_engine/
//Distribution uniform:
std::uniform_int_distribution<int> distribution(1,6);//Lower bound(1), upper bound(6);
//http://www.cplusplus.com/reference/random/uniform_int_distribution/
//------------------Using----------------------------------------------;
//Uniform distributor called with random engine as a parameter:
int dice_roll = distribution(generator);