Package-level declarations

Types

Link copied to clipboard
abstract class Random

A Guest pseudorandom source. Seeded generators and Default are reproducible on Compukters; their sequences are independent of Kotlin/JVM implementations. Not a cryptographic source. Each call executes ordinary metered Guest instructions.

Functions

Link copied to clipboard
fun Random.nextInt(range: IntRange): Int

Uniform value in the inclusive range, including the full Int domain.

Link copied to clipboard

Uniform value in the inclusive range, including the full Long domain.

Link copied to clipboard

fun Random.nextUBytes(array: UByteArray, fromIndex: Int, toIndex: Int): UByteArray

Fills exactly [fromIndex, toIndex); invalid ranges do not consume state or modify the array.

Link copied to clipboard

Unsigned full-width bits from this source.

fun Random.nextUInt(until: UInt): UInt

Uniform value in the inclusive range, including the full UInt domain.

fun Random.nextUInt(from: UInt, until: UInt): UInt

Uniform value in [from, until), using rejection before modulo reduction.

Link copied to clipboard

Unsigned full-width bits from this source.


Uniform value in the inclusive range, including the full ULong domain.

fun Random.nextULong(from: ULong, until: ULong): ULong

Uniform value in [from, until), using rejection before modulo reduction.

Link copied to clipboard
fun Random(seed: Int): Random

Independent reproducible generator; Int seeds sign-extend to Long.

fun Random(seed: Long): Random

Independent reproducible generator with all 64 seed bits retained.