getRandom

fun getRandom(random: Random = ThreadLocalRandom.current()): E(source)

Returns a single random element from the set, with selection probability based on weights.

Parameters

random

An optional Random instance to use for selection. Defaults to ThreadLocalRandom.

Throws

if the set is empty.