diff --git a/orx-noise/src/main/kotlin/Random.kt b/orx-noise/src/main/kotlin/Random.kt index ef5e7d75..619dcb24 100644 --- a/orx-noise/src/main/kotlin/Random.kt +++ b/orx-noise/src/main/kotlin/Random.kt @@ -88,6 +88,10 @@ object Random { val picked = mutableListOf() while(picked.size < count) { + if (list.isEmpty()) { + list = coll.toMutableList() + } + var index = int0(list.size) var newElem = list.elementAt(index) @@ -96,10 +100,6 @@ object Random { newElem = list.elementAt(index) } - if (list.isEmpty()) { - list = coll.toMutableList() - } - picked.add(list[index]) list.removeAt(index) }