Fix frange arguments
This commit is contained in:
parent
1d87f06b12
commit
6da7e7603c
1 changed files with 3 additions and 3 deletions
|
@ -138,13 +138,13 @@ class number extends make {
|
|||
* Returns a float value within the supplied range
|
||||
* @param {number} min - Start value
|
||||
* @param {number} max - End value
|
||||
* @param {number} precision
|
||||
* @param {?number} precision
|
||||
* @returns {number}
|
||||
*/
|
||||
static frange (min, max, precision) {
|
||||
static frange (min, max, precision = null) {
|
||||
let x = Math.random() * (min - max) + max
|
||||
if (precision) {
|
||||
let power = Math.pow(10, precision || 0)
|
||||
let power = Math.pow(10, precision)
|
||||
x = Math.round(x * power) / power
|
||||
}
|
||||
return x
|
||||
|
|
Loading…
Reference in a new issue