Random

class Random(source)

Random control helper. See random.

Functions

Link copied to clipboard
suspend fun accessUnsafe(): Random

Gives uncontrolled access to the underlying Random.

Link copied to clipboard
suspend fun Random.nextBits(bitCount: Int): Int

Generates random bits.

Link copied to clipboard
suspend fun Random.nextBoolean(): Boolean

Generates a random boolean.

Link copied to clipboard
suspend fun Random.nextDouble(): Double
suspend fun Random.nextDouble(from: Double, until: Double): Double

Generates a random double.

Link copied to clipboard
suspend fun Random.nextFloat(): Float

Generates a random float.

Link copied to clipboard
suspend fun Random.nextInt(): Int
suspend fun Random.nextInt(from: Int, until: Int): Int

Generates a random integer.

Link copied to clipboard
suspend fun Random.nextLong(): Long
suspend fun Random.nextLong(from: Long, until: Long): Long

Generates a random integer.

Link copied to clipboard
suspend fun setSeed(seed: Long)

Initializes the underlying Random implementation with seed.

Link copied to clipboard
suspend fun <T> use(block: (Random) -> T): T

Provides block with the underlying Random source.