diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/Ext.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Ext.kt index 04120682f..718e617b1 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/Ext.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Ext.kt @@ -188,24 +188,6 @@ fun > T.prev(values: Array): T { return values[next] } -fun IntArray.shuffle(random: RandomGenerator) { - for (i in lastIndex downTo 1) { - val j = random.nextInt(i + 1) - val copy = this[i] - this[i] = this[j] - this[j] = copy - } -} - -fun MutableList.shuffle(random: RandomGenerator) { - for (i in lastIndex downTo 1) { - val j = random.nextInt(i + 1) - val copy = this[i] - this[i] = this[j] - this[j] = copy - } -} - fun IntArray.shuffle(random: RandomSource) { for (i in lastIndex downTo 1) { val j = random.nextInt(i + 1) @@ -216,12 +198,7 @@ fun IntArray.shuffle(random: RandomSource) { } fun MutableList.shuffle(random: RandomSource) { - for (i in lastIndex downTo 1) { - val j = random.nextInt(i + 1) - val copy = this[i] - this[i] = this[j] - this[j] = copy - } + return Util.shuffle(this, random) } fun List.random(random: RandomGenerator): T {