fromFlow

suspend fun <E> fromFlow(flow: Flow<E>, weighter: Weighter<E>): RandomSelector<E>

Creates a RandomSelector from a weighted finite Flow.

Return

A RandomSelector that selects elements based on their weights.

Parameters

flow

The finite flow of elements.

weighter

A function that determines the weight of each element.