question: 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 ; }
target:  Return a long value uniformly distributed between 0 (inclusive) and n.