The method {@code nextLong} is implemented by class {@code Random}as if by:
{@code}public long nextLong() return ((long)next(32) << 32) + next(32); }}Because class {@code Random} uses a seed with only 48 bits,this algorithm will not return all possible {@code long} values. @return the next pseudorandom, uniformly distributed {@code long}value from this random number generator's sequence
An invocation of this method of the form nextLong() behaves in exactly the same way as the invocation nextLong(radix), where radix
is the default radix of this scanner.
@return the long scanned from the input
@throws InputMismatchException if the next token does not match the Integer regular expression, or is out of range
@throws NoSuchElementException if input is exhausted
@throws IllegalStateException if this scanner is closed
lower
and upper
(endpoints included). The generated long integer values will be random, but not cryptographically secure. To generate cryptographically secure sequences of longs, use nextSecureLong
Preconditions:
lower < upper
(otherwise an IllegalArgumentException is thrown.)lower
and less than or equal to upper
.
lower
and upper
, inclusive.
@param lower the lower bound.
@param upper the upper bound.
@return the random integer.
@throws NumberIsTooLargeException if {@code lower >= upper}.
long
value from this random number generator's sequence. All 264 possible {@code long} valuesshould be produced with (approximately) equal probability.
@return the next pseudorandom, uniformly distributed long
value from this random number generator's sequence
long
value from this random number generator's sequence. All 264 possible {@code long} valuesshould be produced with (approximately) equal probability.
@return the next pseudorandom, uniformly distributed long
value from this random number generator's sequence
long
value from this random number generator's sequence. All 264 possible {@code long} valuesshould be produced with (approximately) equal probability.
@return the next pseudorandom, uniformly distributed long
value from this random number generator's sequence
long
in iteration
@throws java.util.NoSuchElementException if no more elements exist in the iteration
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|