#include <iostream>
#include <cstdlib> //required for rand(), srand()
#include <ctime> //required for time()
using namespace std;
int main() {
srand(time(0)); //randomizing results... (using time as an input)
const int totalNumbersGenerated = 30;
const int minRange = 1, maxRange = 20;
cout<<"
Printing "<<totalNumbersGenerated<<" random integer numbers (from "<<minRange<<" to "<<maxRange<<"):
";
for(int i=1;i<=totalNumbersGenerated;i++){
//generating random number in specified range (inclusive)
cout<<1+((rand () % maxRange) + minRange - 1)<<" ";
}
cout<<endl;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main(){
int n = 5,m = 10;
//Make randomizer depended on time so it returns different value everytime
srand(time(0));
//Now you can get random numbers like this
int a = rand();
//If you want it to be in range of for example integers 'n' and 'm'
int b = rand() % m + n;
//this is gonna be at min 5, and at max 9 since n = 5, m = 10.
/*
NOTE THAT THIS IS NOT A TRUE RANDOMIZER, RANDOMIZING NUMBERS IS NOT A THING,
INSTEAD, PROGRAMMING LANGUAGES HAVE THEIR FORMULAS TO CALCULATE A RANDOM
NUMBER FROM A VALUE THAT YOU PASS TO IT, AND SINCE THIS VALUE IS DEPENDED
ON ThE TIME, IT IS AS RANDOMIZED AS IT CAN GET.
*/
}