mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 03:14:47 +00:00
20 lines
444 B
TypeScript
20 lines
444 B
TypeScript
|
|
export default class NumberTools {
|
|
|
|
//随机
|
|
public static GetRank(min, max) {
|
|
return Math.round(Math.random() * (max - min)) + min;
|
|
}
|
|
|
|
//显示文本数字
|
|
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;
|
|
}
|
|
|
|
}
|
|
|