title: Java n must be positive
body: <p>I receive the 'n must be positive error' on this <code>for</code> loop:</p>
  
  <pre><code>for(int i = 0; i &lt; 8; i++){
          array2[i] = CS2004.numbers.get(rand.nextInt(randomNumbers.size()));
  }
  </code></pre>
  
  <p>Whenever I change it to the following, however, it seems to work well.</p>
  
  <pre><code>for(int i = 0; i &lt; 8; i++){
          array2[i] = CS2004.numbers.get(rand.nextInt(1000 + randomNumbers.size()));
  }
  </code></pre>
  
  <p>Brief background on the method: it reads in a file containing the first 1000 prime numbers and then randomly adds them to an array of size 8.</p>
  
  <p>Also, if I add the number 1 in place of 1000, it provides me with an answer of <code>2.0</code> for every index in the array.  If I change it to 10, then the following is the output: <code>[29.0, 29.0, 17.0, 11.0, 5.0, 19.0, 29.0, 2.0]</code>.  For the sake of completing the example, when <code>100</code> is entered, the following is the result: <code>[61.0, 107.0, 433.0, 193.0, 257.0, 29.0, 463.0, 127.0]</code>.</p>
  
  <p>Does the number <code>(10, 100, 1000, ..., n)</code> 'tell' the result that it can add numbers which are up to the length of n?  Or is it another explanation altogether?</p>
  
  <p>Can anybody tell me why this error comes up?</p>
  
  <p>Thank you.</p>