CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <ctime>
#include <cmath>
using namespace std;
int Random(int a,int b) {
time_t t;
if(a==b) {
b+=1;
}
t-=2017*3600;
int r = abs(int(time(&t)));
int num = (r%b + r%a)*97%(b-a) + a+1;
return num;
}
int main() {
int a,b;
cout<<"\n Enter the limits : ";
cin>>a>>b;
cout<<a<<" "<<b;
int num = Random(a,b);
cout<<"\n Random number generated : ";
cout<<num;
return 0;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run