Fix frange arguments

This commit is contained in:
pyoor 2018-09-13 10:39:46 -04:00
parent 1d87f06b12
commit 6da7e7603c
1 changed files with 3 additions and 3 deletions

View File

@ -138,13 +138,13 @@ class number extends make {
* Returns a float value within the supplied range * Returns a float value within the supplied range
* @param {number} min - Start value * @param {number} min - Start value
* @param {number} max - End value * @param {number} max - End value
* @param {number} precision * @param {?number} precision
* @returns {number} * @returns {number}
*/ */
static frange (min, max, precision) { static frange (min, max, precision = null) {
let x = Math.random() * (min - max) + max let x = Math.random() * (min - max) + max
if (precision) { if (precision) {
let power = Math.pow(10, precision || 0) let power = Math.pow(10, precision)
x = Math.round(x * power) / power x = Math.round(x * power) / power
} }
return x return x