Here is an example of pseudo random number generation:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include<iostream>
#include<cstdlib>
#include<ctime>
usingnamespace std;
int main()
{
int randomNumber;
srand(time(NULL));
for (int i = 0; i < 50; i++)
{
randomNumber = rand() % 100 + 1;
cout << randomNumber << '\n';
}
}
This will output 50 random numbers between 0 and 100.
time.h is from c, to use it in c++ you can include it the way you did but the preferred way is using it's new name ctime. Check out this link about srand( ): http://www.cplusplus.com/reference/clibrary/cstdlib/srand/