title: C# Generating a random number in while loop
body: <p>I've tried everything from YouTube videos to this forum.
  I used to find always a solution here but now I'm stuck.
  I need to generate a random number between 39 and 52.</p>
  
  <p>Here's the somewhat source:</p>
  
  <pre><code>case Form1.number.WITHRANDOM:
  {
      int i = 0;
      while (i &lt; ammount)
      {
          i++;
          int j = 0;
          string text2 = "";
          while (j &lt; 2)
          {
              string value = Conversions.ToString(this.random.Next(0, text.Length));
              text2 += Conversions.ToString(text[Conversions.ToInteger(value)]);
              j++;
          }
          this.numberList.Add("173" + (The random number) + text2);
      }
      break;
  }
  </code></pre>