mercredi 4 mars 2020

Filling an Array with Random numbers, but the rand-Method doesnt work fast enough?

I try to fill array by random [-1,0,1] like this, but outputs like that: -1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0... So it changes to slow? Do i have to set a new seed every time?

Random rnd = new Random();

            int z = rnd.Next(2);
            z -= 1;
            int q = rnd.Next(2);
            q -= 1;



Aucun commentaire:

Enregistrer un commentaire