fix bug 随机0件时死循环

This commit is contained in:
luying
2020-12-23 17:20:50 +08:00
parent 592ee35763
commit be8ae18d24

View File

@@ -276,7 +276,7 @@ export function getRandEelm(source: Array<any> = [], cnt = 1): Array<any> {
while(1) {
let rand = Math.floor(Math.random() * source.length);
idxs.add(rand);
if (idxs.size == cnt) {
if (idxs.size >= cnt) {
break;
}
}