[Solved] random number in constructor c#
In the method h(), the while forms an infinite loop if the atk!=10. so you need to specify an exit condition there to break the loop; you can use like this: public void h() { while (Atk != 10) { this.Atk = random.Next(11); } Console.WriteLine(Atk); } Now you will get a random number between 0 … Read more