crypto-rand

Obtain cryptographically secure random bytes from system sources.

fun main() {
val bytes = try {
CryptoRand.Default.nextBytes(ByteArray(16))
} catch (e: RandomnessProcurementException) {
// Underlying platform APIs failed to procure data
// from system sources.
e.printStackTrace()
return
}

println(bytes.toList())
//
}

Packages

Link copied to clipboard
common