Please help me to solve this - generating 1000 random number in C++.
Use this :
#include <bits/stdc++.h>
using namespace std;
int main() {
for(int i=0;i<1000;i++) `cout<<rand()<<"\n";`
return 0;
}
rand() is a function which returns a random number …
Suppose you want the numbers in a particular range say between a and b , just modify it as
cout<<rand()% (b-a+1);
1 Like