title: random number in constructor c#
body: <p>I am a student taking an introductory programming course in line with game development.  One of my assignments calls for me to define a players attack damage inside of the constructor.  I want the damage to be random, but no matter what I do I get back the same number.  This is a test I made to see how I can get this number to be random.</p>
  
  <pre><code>class MainChar
  {
      public static Random random = new Random();
      public int Atk;        
  
      public MainChar()
      {
          this.Atk = random.Next(11);
      }
  
      public void h()
      {
          while (Atk != 10)
          {
              Console.WriteLine(Atk);
  
          }
      }
  }
  </code></pre>
  
  <p>I'm creating a new instance of MainChar in my main program, and running h().  I get a repeating list of the same number instead of random numbers between 1 and 10.  Any ideas?</p>
  
  <p>P.S. <a href="https://stackoverflow.com/questions/5422141/how-to-generate-a-random-number-in-the-constructor-of-a-class-in-c-sharp">This thread</a> was useful, but could not answer my question.</p>