参数校验

This commit is contained in:
luying
2022-08-11 20:16:44 +08:00
parent dedc16fb05
commit 5ebdb52ce4
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -168,7 +168,9 @@ function randomRank(isBefore: boolean, myRank: number, range: number, len: numbe
let rand = getRandValueByMinMax(n * i + 1, n * (i + 1) + 1, 0); // 因为这个的范围是[min, max),而想要的是 (n * i, n * (i - 1)]
if(rand) {
let ratio = isBefore? -1: 1;
arr.push(myRank + ratio * rand);
let rank = myRank + ratio * rand;
if( rank > 3001) rank = 3001;
arr.push(rank);
}
}
return arr;