question: protected long nextLong ( long n ) { Check . nonNegative ( n ) ; if ( n <= Integer . MAX_VALUE ) { return random . nextInt ( ( int ) n ) ; } else { long bits ; long val ; do { bits = random . nextLong ( ) & Long . MAX_VALUE ; val = bits % n ; } while ( bits - val + ( n - 1 ) < 0 ) ; return val ; } }
target:  Returns a long in the range [0, n).