寻宝:清理匹配成功的玩家信息;修复机器人和匹配条件等bug
This commit is contained in:
@@ -251,13 +251,15 @@ export function getRandEelm(source: Array<any> = [], cnt = 1): Array<any> {
|
||||
if (cnt > source.length) return [];
|
||||
if (cnt === source.length) return source;
|
||||
let idxs = new Set();
|
||||
for (let i = 0; i < cnt; ++i) {
|
||||
|
||||
while(1) {
|
||||
let rand = Math.floor(Math.random() * source.length);
|
||||
idxs.add(rand);
|
||||
if (idxs.size == cnt) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return source.filter((_item, idx) => idxs.has(idx));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user