In this part you will write a function to generate random numbers in a specified range. Specicially we want you to write a function named generateRandom that generates a single random number in a range specified by the user. The function takes two integer parameters representing the lower and upper bounds of the range and it returns an integer random number between the lower and upper bound inclusive. For example, if the parameters are 5 and 25, the function will return a random number between 5 and 25. Write a main function that tests this function by:
1) Asking the user for an integer with which to seed the random number generator. Call srand with this integer.
2) Ask the user for a lower and upper bound for the random number.
3) Asking the user how many random numbers to generate
4) Call generateRandom the requested number of times and prints the generated
random numbers.
Here is what I have that is not working correctly:
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
int seed;
int Lower_Bound;
int Upper_Bound;
int Lower_Bound_Rand;
int Upper_Bound_Rand;
int RandPrint;
int Range;
//Begin Part A:
cout << "Please enter an integer seed for the random number generator: " << endl;
cin >> seed;
cout << "Please enter the lower and upper bounds for the random number: " << endl;
cin >> Lower_Bound >> Upper_Bound;
cout << "Please enter the number of random numbers you wish to print: " << endl;
cin >> RandPrint;
srand(seed);
Lower_Bound_Rand = rand() % Lower_Bound;
Upper_Bound_Rand = rand () % Upper_Bound;
Range = rand()% Lower_Bound && rand()% Upper_Bound;
for (int i =0; i<RandPrint; i++){
cout << "Random integer = " << RandPrint << Range << endl;
}
return 0;
}