Fix pick from Random

This commit is contained in:
Ricardo Matias
2020-03-05 12:55:31 +01:00
parent 857b8714fe
commit e6233ebe9a

View File

@@ -88,6 +88,10 @@ object Random {
val picked = mutableListOf<T>()
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)
}