interface Random
source · line 7public interface Random
A random-bit source with bounded sampling and byte helpers. Cryptographic suitability is determined by the implementation; seeded generators are not cryptographic.
function nextInt
source · line 59public fun nextInt(until: Int): Int
Samples an Int; bounded overloads use a lower-inclusive, upper-exclusive nonempty range, with zero as the default lower bound.
parameter until
source · line 59until: Int
function nextBytes
source · line 122public fun nextBytes(array: MutableArray<Byte>, fromIndex: Long = 0L, toIndex: Long = array.size): MutableArray<Byte>
Produces a new byte array, or fills the supplied array in the half-open index range and returns it. Negative sizes and invalid ranges throw.
parameter fromIndex
source · line 122fromIndex: Long = 0L
parameter array
source · line 122array: MutableArray<Byte>
parameter toIndex
source · line 122toIndex: Long = array.size
function nextULong
source · line 100public fun nextULong(until: ULong): ULong
Samples a ULong; bounded overloads use a lower-inclusive, upper-exclusive nonempty range, with zero as the default lower bound.
parameter until
source · line 100until: ULong
function nextULong
source · line 105public fun nextULong(from: ULong, until: ULong): ULong
Samples a ULong; bounded overloads use a lower-inclusive, upper-exclusive nonempty range, with zero as the default lower bound.
parameter until
source · line 105until: ULong
parameter from
source · line 105from: ULong
function nextULong
source · line 32public fun nextULong(): ULong
Samples a ULong; bounded overloads use a lower-inclusive, upper-exclusive nonempty range, with zero as the default lower bound.
function nextBits
source · line 12public fun nextBits(bitCount: Int): Int
Produces 0..32 random bits in an Int result; implementations reject counts outside that range.
parameter bitCount
source · line 12bitCount: Int
function nextFloat
source · line 45public fun nextFloat(): Float
Samples a Float in [0, 1) using 24 random bits.
function nextInt
source · line 22public fun nextInt(): Int
Samples an Int; bounded overloads use a lower-inclusive, upper-exclusive nonempty range, with zero as the default lower bound.
function nextUInt
source · line 78public fun nextUInt(from: UInt, until: UInt): UInt
Samples a UInt; bounded overloads use a lower-inclusive, upper-exclusive nonempty range, with zero as the default lower bound.
parameter from
source · line 78from: UInt
parameter until
source · line 78until: UInt
function nextUInt
source · line 73public fun nextUInt(until: UInt): UInt
Samples a UInt; bounded overloads use a lower-inclusive, upper-exclusive nonempty range, with zero as the default lower bound.
parameter until
source · line 73until: UInt
function nextLong
source · line 41public fun nextLong(): Long
Samples a Long; bounded overloads use a lower-inclusive, upper-exclusive nonempty range, with zero as the default lower bound.
function nextLong
source · line 86public fun nextLong(until: Long): Long
Samples a Long; bounded overloads use a lower-inclusive, upper-exclusive nonempty range, with zero as the default lower bound.
parameter until
source · line 86until: Long
function nextBoolean
source · line 17public fun nextBoolean(): Boolean
Samples one random bit as a Boolean.
function nextDouble
source · line 49public fun nextDouble(): Double
Samples a Double in [0, 1) using 53 random bits.
function nextBytes
source · line 114public fun nextBytes(size: Long): Array<Byte>
Produces a new byte array, or fills the supplied array in the half-open index range and returns it. Negative sizes and invalid ranges throw.
parameter size
source · line 114size: Long
function nextUInt
source · line 27public fun nextUInt(): UInt
Samples a UInt; bounded overloads use a lower-inclusive, upper-exclusive nonempty range, with zero as the default lower bound.
function nextLong
source · line 91public fun nextLong(from: Long, until: Long): Long
Samples a Long; bounded overloads use a lower-inclusive, upper-exclusive nonempty range, with zero as the default lower bound.
parameter until
source · line 91until: Long
parameter from
source · line 91from: Long
function nextInt
source · line 64public fun nextInt(from: Int, until: Int): Int
Samples an Int; bounded overloads use a lower-inclusive, upper-exclusive nonempty range, with zero as the default lower bound.
parameter until
source · line 64until: Int
parameter from
source · line 64from: Int