17 lines
489 B
TypeScript
17 lines
489 B
TypeScript
import ClassName from "../../container/ClassName";
|
|
import { Injectable } from "../../container/Injectable";
|
|
|
|
@ClassName('MathUtils')
|
|
@Injectable()
|
|
export default class MathUtils {
|
|
className = 'MathUtils';
|
|
|
|
// 得到一个两数之间的随机整数
|
|
public getRandomInt(min: number, max: number): number {
|
|
min = Math.ceil(min);
|
|
max = Math.floor(max);
|
|
//不含最大值,含最小值
|
|
return Math.floor(Math.random() * (max - min)) + min;
|
|
}
|
|
}
|