Returns a random value in a given range.

Uses the JS-internal Math.random(). Use Random for a PRNG with more features.

Note that this method returns floating point numbers, regardless of your inputs potentially being integers. If you require integers, ensure to truncate the resulting random value.

  • Parameters

    • min: number

      The lower bound.

    • max: number

      The upper bound.

    Returns number

    A random value between the lower and upper bound.