Fix pick from Random
This commit is contained in:
@@ -88,6 +88,10 @@ object Random {
|
|||||||
val picked = mutableListOf<T>()
|
val picked = mutableListOf<T>()
|
||||||
|
|
||||||
while(picked.size < count) {
|
while(picked.size < count) {
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
list = coll.toMutableList()
|
||||||
|
}
|
||||||
|
|
||||||
var index = int0(list.size)
|
var index = int0(list.size)
|
||||||
var newElem = list.elementAt(index)
|
var newElem = list.elementAt(index)
|
||||||
|
|
||||||
@@ -96,10 +100,6 @@ object Random {
|
|||||||
newElem = list.elementAt(index)
|
newElem = list.elementAt(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (list.isEmpty()) {
|
|
||||||
list = coll.toMutableList()
|
|
||||||
}
|
|
||||||
|
|
||||||
picked.add(list[index])
|
picked.add(list[index])
|
||||||
list.removeAt(index)
|
list.removeAt(index)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user