diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/util/RandomUtils.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/util/RandomUtils.kt index b4a152927..33602b9b5 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/util/RandomUtils.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/util/RandomUtils.kt @@ -78,6 +78,17 @@ fun IntArray.shuffle(random: RandomSource): IntArray { return this } +fun Array.shuffle(random: RandomSource): Array { + for (i in lastIndex downTo 1) { + val j = random.nextInt(i + 1) + val copy = this[i] + this[i] = this[j] + this[j] = copy + } + + return this +} + fun L.shuffle(random: RandomSource): L { for (i in lastIndex downTo 1) { val j = random.nextInt(i + 1)