import Decimal from 'decimal.js';
// 加法
function add(...nums: number[]): number {
return nums.reduce((total, num) => new Decimal(total).plus(num), 0).toNumber();
}
// 减法
function subtract(...nums: number[]): number {
return nums.reduce((total, num) => new Decimal(t...
function getRandom(start, end, fixed = 0) {
let differ = end - start
let random = Math.random()
return (start + differ * random).toFixed(fixed)
}getRandom(1,5) 1<= num >=5