W3cubDocs

/Kotlin

shuffle

Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
fun <T> Array<T>.shuffle()
fun ByteArray.shuffle()
fun ShortArray.shuffle()
fun IntArray.shuffle()
fun LongArray.shuffle()
fun FloatArray.shuffle()
fun DoubleArray.shuffle()
fun BooleanArray.shuffle()
fun CharArray.shuffle()
@ExperimentalUnsignedTypes fun UIntArray.shuffle()
@ExperimentalUnsignedTypes fun ULongArray.shuffle()
@ExperimentalUnsignedTypes fun UByteArray.shuffle()
@ExperimentalUnsignedTypes fun UShortArray.shuffle()

Randomly shuffles elements in this array in-place.

Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
fun <T> Array<T>.shuffle(random: Random)
fun ByteArray.shuffle(random: Random)
fun ShortArray.shuffle(random: Random)
fun IntArray.shuffle(random: Random)
fun LongArray.shuffle(random: Random)
fun FloatArray.shuffle(random: Random)
fun DoubleArray.shuffle(random: Random)
fun BooleanArray.shuffle(random: Random)
fun CharArray.shuffle(random: Random)
@ExperimentalUnsignedTypes fun UIntArray.shuffle(
    random: Random)
@ExperimentalUnsignedTypes fun ULongArray.shuffle(
    random: Random)
@ExperimentalUnsignedTypes fun UByteArray.shuffle(
    random: Random)
@ExperimentalUnsignedTypes fun UShortArray.shuffle(
    random: Random)

Randomly shuffles elements in this array in-place using the specified random instance as the source of randomness.

See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm

Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)
fun <T> MutableList<T>.shuffle(random: Random)

Randomly shuffles elements in this list in-place using the specified random instance as the source of randomness.

See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm

Platform and version requirements: JVM (1.2), JS (1.2), Native (1.2)
fun <T> MutableList<T>.shuffle()
For JVM

Randomly shuffles elements in this mutable list.

For JS, Native

Randomly shuffles elements in this list.

See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm

Platform and version requirements: JVM (1.2)
fun <T> MutableList<T>.shuffle(random: Random)

Randomly shuffles elements in this mutable list using the specified random instance as the source of randomness.

© 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.collections/shuffle.html