20 lines
444 B
TypeScript
Raw Normal View History

2023-12-18 10:03:28 +08:00
export default class NumberTools {
//随机
2024-01-10 01:36:20 +08:00
public static GetRank(min, max) {
2023-12-18 10:03:28 +08:00
return Math.round(Math.random() * (max - min)) + min;
}
2024-01-10 01:36:20 +08:00
//显示文本数字
public static NumberStr(value:number){
if(Math.floor(value / 1000000))
return `${(value / 1000000).toFixed(1)}M`
if(Math.floor(value / 1000))
return `${(value / 1000).toFixed(1)}K`
return value;
}
2023-12-18 10:03:28 +08:00
}