nextDouble

open override fun nextDouble(): Double(source)

Gets the next random Double value uniformly distributed between 0 (inclusive) and 1 (exclusive).

Since Kotlin

1.3

Samples


open override fun nextDouble(until: Double): Double(source)

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

Generates a Double random value uniformly distributed between 0 (inclusive) and until (exclusive).

Since Kotlin

1.3

Throws

if until is negative or zero.

Samples


open override fun nextDouble(from: Double, until: Double): Double(source)

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

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

from and until must be finite otherwise the behavior is unspecified.

Since Kotlin

1.3

Throws

if from is greater than or equal to until.

Samples