W3cubDocs

/Kotlin

shuffled

Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
fun <T> Sequence<T>.shuffled(): Sequence<T>

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.

Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
fun <T> Sequence<T>.shuffled(random: Random): Sequence<T>

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.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.sequences/shuffled.html