lundi 21 août 2017

Randome Generator that dosnt repeat C#

So i need 6 generated Numbers, wich dosnt repeat. But more than just one time. I think it overwrite the first 6 Numbers again and again instand of adding them to the Array(ausgabe).

I tried something like

ausgabe += Enumerable.Range(1, 49).OrderBy(x => rnd.Next()).Take(6).ToArray();

or

ausgabe[j] = Enumerable.Range(1, 49).OrderBy(x => rnd.Next()).Take(6).ToArray();

But it dosnt realy went well. Pls help me.

here is my Code:

for (int j = 0; j < (max + 1); j++)
        {
            ausgabe = Enumerable.Range(1, 49).OrderBy(x => rnd.Next()).Take(6).ToArray();
        }

(The Next Six Numbers can be the same as the first row, but the six can't be the same as in the same row. Well sry for my English-Skills, i think they are a little bit bad :/)




Aucun commentaire:

Enregistrer un commentaire