最小值和最大值之间的随机数
placeholderCopyfunction randomMinMax(min:Number, max:Number):Number {
return (min + (Math.random() * Math.abs(max - min)));
}
通过传递一系列最小值和最大值来调用此函数。
例:
placeholderCopyrandomMinMax(1, 10);
示例输出:
- 1.661770915146917
- 2.5521070677787066
- 9.436270965728909