random

fun Int.random(): Int

Returns a random Int between 0 (inclusive) and this value (exclusive).

Extension function on Int. It draws from Random.Default, which is not cryptographically secure: do not use it for tokens, IDs, salts or anything else an attacker must not guess. On the JVM, randomId() and newByteArraySalt() use SecureRandom.


Returns a random Long between 0 (inclusive) and this value (exclusive).

Extension function on Long. It draws from Random.Default, which is not cryptographically secure: do not use it for tokens, IDs, salts or anything else an attacker must not guess. On the JVM, randomId() and newByteArraySalt() use SecureRandom.