Hello

I have a function that should store random numbers in an array and also check if there are any repeated numbers.

**My problem** is that I cannot figure out how to 'repair'/get rid of repeated numbers & make them ...unrepeated numbers? :P

Any advice on how I can alter this function? :)

```
void random(int array[], int max) {
int n;
int match = 0; // check if any numbers are repeated
for (int i = 0; i < 6; i++)
{
n = (rand()%max)+1;
for (int j=0; j<6; j++) {
if (n == array[j]) {
match++;
}
}
if (match==0) { // if no numbers have been repeated
array[i] = n;
}
else { array[i] = n-1; } // there are repeats
match = 0; // reset match variable
}
}
```