title: How to test whether a sequence of integers was randomly generated?
body: <p>So I am trying to test if a sequence of integers was randomly generated, but it doesn't work... 
  this is what I've got so far:</p>
  
  <pre><code>public static void main(String[] args) {
      Random r = new Random();
      int[] sequence = { r.nextInt(), r.nextInt(), r.nextInt() };
      System.out.println(isRandomSequence(sequence));
  }
  
  public static boolean isRandomSequence(int[] sequence) {
      for (long seed = 0; seed &lt; Long.MAX_VALUE; ++seed) {
          Random r = new Random(seed);
          long tries = 0;
          for (int i = 0; tries &lt; Long.MAX_VALUE; ++tries) {
              if (sequence[i] == r.nextInt()) {
                  if (++i == sequence.length) return true;
              } else {
                  i = 0;
              }
          }
      }
      return false;
  }
  </code></pre>
  
  <p>Edit: to clarify; I want to know if, for instance the sequence { 4, 5, 6 } was generated by the random number generator. For starters limiting the testing to the java.util.Random (would be nice to have a general solution though if it's possible).</p>