Function randomFloat

Returns a random floating point number between the given minimum (inclusive) and maximum (inclusive) values.
Uses Math.random() internally to generate the random number and can be rounded to a specified number of decimal places.

randomFloat(0, 10); // 5.23
randomFloat(0, 10, 4); // 5.2345
  • Parameters

    • min: number

      min value

    • max: number

      max value

    • decimals: number = 2

    Returns number

    the random float value