I am trying to generate 6 random numbers and add them all into an array. I am able to generate the numbers in the range that I want and add them to the array. However, I am not sure how to make sure the number isn't repeated twice. This is what I have so far:
Random rnd = new Random();
int[] RandomHorse = new int[6];
for (int i = 0; i < RandomHorse.Length; i++)
{
RandomHorse[i] = rnd.Next(HorseList.Count);
}
Aucun commentaire:
Enregistrer un commentaire