SO here it is;
start with an array that couts random numbers I used the generate function
now check those numbers if they repeat so return true
if false is returned then you can go onto the next random_integer to check..here I use the contains function
the problem is generate is an int function that makes numbers, and I'm checking those numbers in that array with a bool function....help plz
int generate(int array[], int n, int lower, int upper)
{
for (int i=0;i<n;i++)
{
array[i]=lower + rand()%(upper-lower+1);
contains
}
return 0;
}
bool contains( int nums[], int random_integer)
{
int size;
int max;
int min;
for(int index=0;index<size)
{
nums[index]=//initialize nums wth the numbers in generate
}
if (generate [random-integer-1==nums[], max, min)
{
generate [random_integer-1]);
cout<<random_integer<<endl;
return false;//if the number is not already there then it's false and then you can check next
index++;
}
else
{
return true;
}
}
int main()
{
srand(time(0));