1
I am doing a college project where I need to simulate the lottery, so I have an array with the name of 20 teams and I need to draw 10 teams but without repeating any and present these teams in a Listbox, but I am not succeeding, could give me suggestions on how to create this method of drawing?
And if possible, some way to add the values of a Checkbox in a array to make the comparison with the teams drawn.
Man array:
public String[] times =
{
"Corinthians"
,"Palmeiras"
,"Santos"
,"Grêmio"
,"Cruzeiro"
,"Botafogo"
,"Flamengo"
,"Vasco da Gama"
,"Atlético-PR"
,"Atlético"
,"São Paulo"
,"Chapecoense"
,"Bahia"
,"Fluminense"
,"Sport Recife"
,"Coritiba"
,"Ponte Preta"
,"Avaí"
,"EC Vitória"
};
As the original question shows, do not use
Random
repeatedly, use it only to shuffle. The answer here is quadratic and has poor performance.– Maniero