属性随机使用既有方法
This commit is contained in:
@@ -293,6 +293,19 @@ export function getRandValue(base: number, ratio: number, decimal = 2): number {
|
||||
return parseFloat((base * (1 - ratio + Math.random() * ratio * 2)).toFixed(decimal));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 在给定最大最小值中随机一个值
|
||||
* @param min 最小
|
||||
* @param max 最大
|
||||
* @param decimal 返回值保留的小数位数
|
||||
*/
|
||||
export function getRandValueByMinMax(min: number, max: number, decimal = 2): number {
|
||||
return parseFloat((min + (max - min) * Math.random()).toFixed(decimal));
|
||||
|
||||
}
|
||||
|
||||
|
||||
export function resResult(status: {code: number, simStr: string}, data = null, customMsg = '') {
|
||||
const { code, simStr } = status;
|
||||
if (code !== STATUS.SUCCESS.code) {
|
||||
|
||||
Reference in New Issue
Block a user