Companion

object Companion

Functions

Link copied to clipboard
suspend fun <E> fromFlow(flow: Flow<E>, weighter: Weighter<E>): RandomSelector<E>

Creates a RandomSelector from a weighted finite Flow.

Link copied to clipboard
fun <E> fromInfinityFlow(flow: Flow<E>, weighter: Weighter<E>): RandomSelector<E>

Creates a RandomSelector from an infinite weighted Flow.

Link copied to clipboard
fun <E> fromIterable(iterable: Iterable<E>): RandomSelector<E>

Creates a RandomSelector from an Iterable, using uniform selection probabilities.

Link copied to clipboard

Creates a RandomSelector from a weighted Iterable of elements that implement Weighted.

fun <E> fromWeightedIterable(iterable: Iterable<E>, weighter: Weighter<E>): RandomSelector<E>

Creates a RandomSelector from a weighted Iterable.