Salutations,
I'm writing a function that generates an array of random values between 1 and 49 for a lottery game. Assigning the random values to each slots in the array is easy enough (already wrote a functioning value generator), as is sorting the values in the array, but then I have to validate that they're all unique.
Thanks in advance for any help, either directly here or by pointing me in the good direction. (Didn't find exactly what I was looking for with the prompted suggestions.)
    void generateLottery(short lottery[], const short LENGTH, const short MIN, const short MAX) {
    for (short i = 0; i < LENGTH; i++) {
        short counter = 0;
        lottery[i] = generateRandomValue(MIN, MAX);
        while (lottery[counter] != NULL) {
            if (lottery[i] == lottery[counter]) {
                lottery[i] = generateRandomValue(MIN, MAX);
            }
            counter++;
        }
    }
    sortLottery(lottery, LENGTH);
}
 
     
     
    