Package kotlin.random
Provides the default generator of pseudo-random values, the repeatable generator, and a base class for other RNG implementations.
Types
Random
An abstract class that is implemented by random number generator algorithms.
abstract class Random
Extensions for External Classes
Functions
asJavaRandom
Creates a java.util.Random instance that uses the specified Kotlin Random generator as a randomness source.
nextUBytes
Fills the specified unsigned byte array with random bytes and returns it.
fun Random.nextUBytes(array: UByteArray): UByteArray
Creates an unsigned byte array of the specified size, filled with random bytes.
fun Random.nextUBytes(size: Int): UByteArray
Fills a subrange of the specified UByte
array starting from fromIndex inclusive and ending toIndex exclusive with random UBytes.
fun Random.nextUBytes(
array: UByteArray,
fromIndex: Int = 0,
toIndex: Int = array.size
): UByteArray
nextUInt
Gets the next random UInt from the random number generator in the specified range.
nextULong
Gets the next random ULong from the random number generator in the specified range.
Gets the next random ULong from the random number generator in the specified range.
fun Random.nextULong(range: ULongRange): ULong