title: Random long, can it be twice in a row the same number
body: <p>I was wondering with the current java 1.7 implementation of the Random class, is it possible for the code below to generate two times the same random long?</p>
  
  <pre><code>Random rand = new Random((long) "some seed".hashCode());
  while(rand.nextLong() != rand.nextLong()){
  
  }
  
  System.out.println("Will this text ever be on the console?");
  </code></pre>
  
  <p>Java source for nextLong() and next();</p>
  
  <pre><code>public long nextLong(){
      return ((long) next(32) &lt;&lt; 32) + next(32);
  }
  
  protected synchronized int next(int bits){
      seed = (seed * 0x5DEECE66DL + 0xBL) &amp; ((1L &lt;&lt; 48) - 1);
      return (int) (seed &gt;&gt;&gt; (48 - bits));
  }
  </code></pre>
  
  <p>I would answer this question with false because I think the random method used by java does not repeat the same numbers for a 2^48 period, so it would never generate two the same numbers in a row. Is this correct?</p>