shuffled

Common
JVM
JS
Native
1.4
fun <T> Sequence<T>.shuffled(): Sequence<T>
(source)

Returns a sequence that yields elements of this sequence randomly shuffled.

Note that every iteration of the sequence returns elements in a different order.

The operation is intermediate and stateful.

Common
JVM
JS
Native
1.4
fun <T> Sequence<T>.shuffled(random: Random): Sequence<T>
(source)

Returns a sequence that yields elements of this sequence randomly shuffled using the specified random instance as the source of randomness.

Note that every iteration of the sequence returns elements in a different order.

The operation is intermediate and stateful.