+ 1
How do you make a random number generator with C++?
I made a random number generator earlier and it was really long and took me a long time. Then the stupid coding template on this website start messing up and I want to know how you can make a easier generator or stop the code from ****ing with me.
2 odpowiedzi
+ 1
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
srand(time(0));
int num;
cout << "Random number from 1 to... ";
cin >> num;
cout << "Random number: " << rand() % num + 1;
return 0;
}