nextLong

Common
JVM
JS
Native
1.0
fun nextLong(): Long

Gets the next random Long from the random number generator.

Generates a Long random value uniformly distributed between Long.MIN_VALUE and Long.MAX_VALUE (inclusive).

Common
JVM
JS
Native
1.0
fun nextLong(until: Long): Long

Gets the next random non-negative Long from the random number generator less than the specified until bound.

Generates a Long random value uniformly distributed between 0 (inclusive) and the specified until bound (exclusive).

Parameters

until - must be positive.

Exceptions

IllegalArgumentException - if until is negative or zero.

Common
JVM
JS
Native
1.0
fun nextLong(from: Long, until: Long): Long

Gets the next random Long from the random number generator in the specified range.

Generates a Long random value uniformly distributed between the specified from (inclusive) and until (exclusive) bounds.

Exceptions

IllegalArgumentException - if from is greater than or equal to until.