0

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;
J C T
  • 1
  • 2
  • _Do i have to set a new seed every time?_ On the contrary!! If you do the result will NOT be random! – TaW Mar 04 '20 at 10:53
  • There's no array in what you show here. – 500 - Internal Server Error Mar 04 '20 at 10:54
  • Thanks, the question has been answered before - I'm still figuring out how to use method "StaticRandom" in the article. – J C T Mar 04 '20 at 11:03
  • _I'm still figuring out how to use method "StaticRandom" in the article_ Ignore it! - The 1st paragraph is really all you need: Stick to one Random object for all your numbers! – TaW Mar 04 '20 at 12:51

0 Answers0