nextBytes

open fun nextBytes(array: ByteArray, fromIndex: Int = 0, toIndex: Int = array.size): ByteArray(source)

Fills a subrange of the specified byte array starting from fromIndex inclusive and ending toIndex exclusive with random bytes.

Since Kotlin

1.3

Return

array with the subrange filled with random bytes.

Samples


open fun nextBytes(array: ByteArray): ByteArray(source)

Fills the specified byte array with random bytes and returns it.

Since Kotlin

1.3

Return

array filled with random bytes.

Samples


open fun nextBytes(size: Int): ByteArray(source)

Creates a byte array of the specified size, filled with random bytes.

Since Kotlin

1.3

Samples