物品:获取装备上限

This commit is contained in:
luying
2021-08-02 20:47:39 +08:00
parent abb74b9e6b
commit 2e961691b5
14 changed files with 315 additions and 222 deletions

View File

@@ -251,7 +251,8 @@ export function getRandValue(base: number, ratio: number, decimal = 2): number {
* @param decimal 返回值保留的小数位数
*/
export function getRandValueByMinMax(min: number, max: number, decimal = 2): number {
return parseFloat((min + (max - min) * Math.random()).toFixed(decimal));
let pow = Math.pow(10, decimal);
return Math.floor((min + (max - min) * Math.random()) * pow)/pow;
}