fix bug 随机0件时死循环
This commit is contained in:
@@ -276,7 +276,7 @@ export function getRandEelm(source: Array<any> = [], cnt = 1): Array<any> {
|
|||||||
while(1) {
|
while(1) {
|
||||||
let rand = Math.floor(Math.random() * source.length);
|
let rand = Math.floor(Math.random() * source.length);
|
||||||
idxs.add(rand);
|
idxs.add(rand);
|
||||||
if (idxs.size == cnt) {
|
if (idxs.size >= cnt) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user