title: randomly generate 100 unique numbers using Math.random
body: <p>I want to print out an array of those 100 numbers.  However, my program stops after generating certain amount of numbers. Here's my code.</p>
  
  <pre><code>class A4
      public static void main(String[] args)
      {
          int[] array1 = new int[101];
          int num, i = 0;
          boolean repeat = false;
          while(i &lt; 100)
          {   
              num = (int) (Math.random() * 100) + 1;
              array1[(i)] = num;
              for (int e = 0; e &lt; i; e++)
              {
                  if (num == array1[e])
                      repeat = true;
              }
  
              if (repeat == true)
              {
                  continue;
              }
  
              array1[i] = num;
              System.out.println(array1[i]);
              i++;
          }
      }
  }
  </code></pre>