selectUnbiased

inline suspend fun <R> selectUnbiased(crossinline builder: SelectBuilder<R>.() -> Unit): R

Waits for the result of multiple suspending functions simultaneously like select, but in an unbiased way when multiple clauses are selectable at the same time.

This unbiased implementation of select expression randomly shuffles the clauses before checking if they are selectable, thus ensuring that there is no statistical bias to the selection of the first clauses.

See select function description for all the other details.

Sources

common source
Link copied to clipboard