0

I have made... well attempted at making a unique random number generator using arrays and functions, but it still will not work and I cannot find my error at all. Can someone please help? T_T

```
#include <iostream>
#include <ctime>
using namespace std;
// *****Function prototypes****
void displayArray(int randNum[], int elements);
int randNums(int randNum[], int elements);
int main ()
{
//declare array
int numbers[6] = {0};
//random number generator
srand(static_cast<int>(time(0)));
randNums(numbers, 6);
displayArray(numbers, 6);
system("pause");
return 0;
}
//****Functions****
int randNums(int randNum[],int elements)
{
//declare variable
int value = 0;
bool checker[6]; // this number has to change if the range is to be bigger or smaller
for (int sub = 0; sub < 6; sub ++) // this one as well
{
checker[sub] = false; //assigns false to a random number in the array set
}
for (int sub = 0; sub < 6; sub++) // this number changes as well
{
value = 1 + rand() % 6; // this number must change as well
if(checker[value])
{
sub--;
}
else
randNum[sub] = value;
checker[value] = true; //if hasnt been picked it assigns that number
}
return value;
}
void displayArray(int randNum[], int elements)
{
for (int sub = 0; sub < elements; sub ++)
{
cout << "Your lottery numbers are: " << randNum[sub] << endl;
}
}
```