Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Xinzhu Men
- //ID:0492273
- //Date: 2/25/2017
- //Journals 3B
- //random numbers
- #include <iostream>
- #include <ctime>
- using namespace std;
- int randrange(int x, int y);
- int main()
- {
- int min, max;
- srand((unsigned int) time(0));
- cout << "Enter your min value " << endl;
- cin >> min;
- cout << "Enter your maxvalue " << endl;
- cin >> max;
- for (int j = 0; j < 10; j++)
- {
- for(int i = 0; i < 10 ; i++)
- {
- cout << randrange (min,max);
- cout << (rand() % (1 + max - min) + min)<< "\t ";
- }
- cout << endl;
- }
- return 0;
- }
- int randrange(int x, int y)
- {
- cout << (rand() % (1 + x - y) + y)<< "\t ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement