I want to generate 7 random numbers from 0 to 39 and store them in one dimensional array. I must make sure each number is different (can't have two 7s for example).
I thought about shuffling numbers, but I only need 7 out of 40. I actually have to do this in school and we haven't covered pointers yet and we're using rand() function to get random numbers. I guess the solution doesn't have to be truly random, but at least somewhat.
Aucun commentaire:
Enregistrer un commentaire