RandomPicks

port of com.carrotsearch.randomizedtesting.generators.RandomPicks

Functions

Link copied to clipboard
fun <T> randomFrom(r: Random, array: Array<T>): T

Pick a random object from the given array.

fun randomFrom(r: Random, array: ByteArray): Byte
fun randomFrom(r: Random, array: CharArray): Char
fun randomFrom(r: Random, array: IntArray): Int
fun randomFrom(r: Random, array: LongArray): Long

fun <T> randomFrom(r: Random, collection: MutableCollection<T>): T

Pick a random object from the collection. Requires linear scanning.

fun <T> randomFrom(r: Random, list: MutableList<T>): T

Pick a random object from the given list.