Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int Rand(int min, int max){
- int q = max - min;
- int r = rand() % q;
- r += min;
- return r;
- }
- int main(){
- cout << "rand: " << Rand(0, 100) << endl;
- cout << "rand: " << Rand(0, 100) << endl;
- cout << "rand: " << Rand(0, 100) << endl;
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment