title: Why won't my random string generator generate 100,000 strings consistently?
body: <p>I made a random string generator for a class, as I need a very large dataset to run efficiency tests for sorts. For some reason, it sometimes will only generate ~93,000 - 99,000 strings, even though it is set up to run the loop 100,000 times. The only thing I can think of is some sort of memory issue, but I don't know how to fix it.</p>
  
  <p>"Generate a random string length between 4 and 8, then generate a string of that length with random lowercase chars. It runs NO_OF_STR times, which is 100,000 here."</p>
  
  <pre><code>        final int NO_OF_STR = 100000;
          final int STR_SIZE_MIN = 3;
          final int STR_SIZE_MAX = 8;
  
          char[] alpha = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
          BufferedWriter writer = new BufferedWriter(new FileWriter("/Users/gigabyted/Documents/Projects/Eclipse/RandomStringGenerator/src/strings.txt"));
          BufferedReader reader = new BufferedReader(new FileReader("/Users/gigabyted/Documents/Projects/Eclipse/RandomStringGenerator/src/strings.txt"));
          int bound = 0;
          Random ran1 = new Random();
          Random ran2 = new Random();
          int test = 0;
          String dupliTest;
          String[] dupliTestArr = new String[NO_OF_STR];
  
          for (int i = 0; i &lt; NO_OF_STR; i++) {
              bound = ran1.nextInt(STR_SIZE_MAX - STR_SIZE_MIN) + STR_SIZE_MIN;
              for (int j = bound ; j &gt;= 0; j--) {
                  writer.write(alpha[ran2.nextInt(26)]);
              }
              writer.write("\n");
  
              test++;
  
              //System.out.println("String #" + (i + 1) + " generated.");
          }
  </code></pre>