shuffle

Common
JVM
JS
Native
1.4
fun <T> Array<T>.shuffle()
(source)
fun ByteArray.shuffle()
(source)
fun ShortArray.shuffle()
(source)
fun IntArray.shuffle()
(source)
fun LongArray.shuffle()
(source)
fun FloatArray.shuffle()
(source)
fun DoubleArray.shuffle()
(source)
fun BooleanArray.shuffle()
(source)
fun CharArray.shuffle()
(source)
@ExperimentalUnsignedTypes fun UIntArray.shuffle()
(source)
@ExperimentalUnsignedTypes fun ULongArray.shuffle()
(source)
@ExperimentalUnsignedTypes fun UByteArray.shuffle()
(source)
@ExperimentalUnsignedTypes fun UShortArray.shuffle()
(source)

Randomly shuffles elements in this array in-place.

Common
JVM
JS
Native
1.4
fun <T> Array<T>.shuffle(random: Random)
(source)
fun ByteArray.shuffle(random: Random)
(source)
fun ShortArray.shuffle(random: Random)
(source)
fun IntArray.shuffle(random: Random)
(source)
fun LongArray.shuffle(random: Random)
(source)
fun FloatArray.shuffle(random: Random)
(source)
fun DoubleArray.shuffle(random: Random)
(source)
fun BooleanArray.shuffle(random: Random)
(source)
fun CharArray.shuffle(random: Random)
(source)
@ExperimentalUnsignedTypes fun UIntArray.shuffle(
    random: Random)

(source)
@ExperimentalUnsignedTypes fun ULongArray.shuffle(
    random: Random)

(source)
@ExperimentalUnsignedTypes fun UByteArray.shuffle(
    random: Random)

(source)
@ExperimentalUnsignedTypes fun UShortArray.shuffle(
    random: Random)

(source)

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

Common
JVM
JS
Native
1.3
fun <T> MutableList<T>.shuffle(random: Random)
(source)

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

Common
JVM
JS
Native
1.2
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

JVM
1.2
fun <T> MutableList<T>.shuffle(random: Random)
(source)

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