Answer the question
In order to leave comments, you need to log in
C# Why does random always output the same numbers?
Good afternoon.
Just started learning C#.
You need to make a random number generator. It turns out this code:
Random randM = new Random();
Random randV = new Random();
Random randL = new Random();
Mas = randMt.Next(1, 7)+6;
label6.Text = String.Format("{0}", Mas);
Vin = randV.Next(2, 13) + 12;
label7.Text = String.Format("{0}", Vin);
Ud = randL.Next(1, 7) + 6;
label8.Text = String.Format("{0}", Ud);
Answer the question
In order to leave comments, you need to log in
Um... honestly speaking it's strange... It will be necessary to dig.
To make it work, do this:
Random rand = new Random();
Mas = rand.Next(1, 7)+6;
label6.Text = Mas.ToString();
Vin = rand.Next(2, 13) + 12;
label7.Text = Vin.ToString();
Ud = rand.Next(1, 7) + 6;
label8.Text = Ud.ToString();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question