hello
How do I ensure that the same number does not appear more than once in my random number creator?
Eg of output currently:
array = {30, 2, 12, 9, 2}; // has repeats
Eg of what I am trying to do:
array = {30, 2, 12, 9, 7}; // no repeated numbers
void generate_post::random(int array[], int max) {
srand(time(NULL));
for (int i = 0; i < 6; i++)
{
array[i] = (rand()%max)+1;
}
}