private long nextLong(long n){
  long bits;
  long val;
  do {
    bits=(rnd.nextLong() << 1) >>> 1;
    val=bits % n;
  }
 while (bits - val + (n - 1) < 0L);
  return val;
}

private long nextLong ( long n ) { long bits ; long val ; do { bits = ( rnd . nextLong ( ) << 1 ) > > > 1 ; val = bits % n ; } while ( bits - val + ( n - 1 ) < 0L ) ; return val ; }
return a long value uniformly distributed between 0 ( inclusive ) and n .
