I'm working on a Bingo in C # for a facul job and I need to do a vector of so many values and do not ever repeat those values, I'm using the following procedure to generate the raffle values ↓
public static void GeraBingo(int[] v)
{
Random r = new Random();
for (int i = 0; i < v.Count(); i++)
{
v[i] = r.Next(1, 10); // gera 1 a 10 e vai gerar quantos o v.Count() mandar
Thread.Sleep(1000); // pausa 1000 miliseg.
}
}
This code generates the vector, but I am not able to assimilate a method for not entering repeated.
With this code above I can get a vector like this: and as it is visible it repeats some values. | 9 | 2 | 5 | 6 | 5 | 4 | 2 | 4 | 6 | 5 | This method is for working with only an array of int values and not letting it repeat values.