mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-05-30 18:39:18 +08:00
RandomManager添加生成指定范围的随机浮点数方法
This commit is contained in:
@@ -26,6 +26,16 @@ export class RandomManager {
|
||||
this.seedrandom = new Math.seedrandom(seed);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成指定范围的随机浮点数
|
||||
* @param min 最小值
|
||||
* @param max 最大值
|
||||
* @param type 类型
|
||||
*/
|
||||
getRandomFloat(min: number, max: number): number {
|
||||
return this.getRandom() * (max - min) + min;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成指定范围的随机整数
|
||||
* @param min 最小值
|
||||
|
||||
Reference in New Issue
Block a user