net.corda.core / kotlin.collections.List / randomOrNull

randomOrNull

fun <T> List<T>.randomOrNull(): T?

Returns a random element in the list, or null if empty



fun <T> List<T>.randomOrNull(predicate: (T) -> Boolean): <ERROR CLASS>

Returns a random element in the list matching the given predicate, or null if none found