title: For loop that doesn't iterate completely but displays no error message
body: <p>I have a simple program that uses Random and a for loop to generate two six-digit numbers. The loop generates two numbers every time and most of the time both numbers are six digits. Sometimes, though, one of those numbers is less than 6 digits (4 to 5 digits). It generates no error message in all cases. What's going on? I've posted all the code although some of it is unused/tested until I can figure out the Random problem.</p>
  
  <p>The  six-digit number starts as an empty string. Random generates an integer, the integer gets converted to string then += onto six-digit number string, which is converted to an integer when the method finishes. </p>
  
  <p>The rest of the program is unimplemented and will involve extracting the 2nd, 4th, and 6th place digits in each number and adding them all together. The troubling thing is the Random issue.</p>
  
  <pre><code>static void Main(string[] args)
  {
      Numbers theNumbers = new Numbers();
      Console.WriteLine(string.Join(",", theNumbers.Ints[0]));
      Console.WriteLine(string.Join(",", theNumbers.Ints[1]));
  }
  </code></pre>
  
  <p>Numbers class</p>
  
  <pre><code>class Numbers
  {
      public int[] Ints { get; set; }
  
  
      public Numbers()
      {
          Ints = new int[5];
  
          CreateTheFirstTwoNumbers(new RandomNummberGenerator());
  
      }
  
      public int[] CreateTheFirstTwoNumbers(RandomNummberGenerator RNG) 
      {
          for (int arrayIndex = 0; arrayIndex &lt; 2; arrayIndex++)
          {
              Ints[arrayIndex] = RNG.CreateRandomNumber();
          }
  
          return Ints;
      }
  </code></pre>
  
  <p>Random Number Generator class   </p>
  
  <pre><code>class RandomNummberGenerator
  {
      public Random  Generator { get; set; }
  
      public RandomNummberGenerator()
      {
          Generator = new Random();
      }
  
      public int CreateRandomNumber()
      {
          string number = "";
  
          for (int numberIndex = 0; numberIndex &lt; 6; numberIndex++)
          {
              number += Generator.Next(0, 10).ToString();
          }
  
          return int.Parse(number);
      }
  }
  </code></pre>