final int internalNextInt ( int origin , int bound ) { int r = mix32 ( nextSeed ( ) ) ; if ( origin < bound ) { int n = bound - origin , m = n - 1 ; if ( ( n & m ) == 0 ) r = ( r & m ) + origin ; else if ( n > 0 ) { for ( int u = r >>> 1 ; u + m - ( r = u % n ) < 0 ; u = mix32 ( nextSeed ( ) ) >>> 1 ) ; r += origin ; } else { while ( r < origin || r >= bound ) r = mix32 ( nextSeed ( ) ) ; } } return r ; }
The form of nextInt used by IntStream Spliterators . Exactly the same as long version except for types .