• Category

    Generate a random number within the given bounds.

    Time complexity: O(1)

    Space complexity: O(1)

    Parameters

    • min: number

      Lower bound (inclusive) of the output range

    • max: number

      Upper bound (exclusive) of the output range

    Returns number

    A random number within the given bounds

    Math

    Example

    const value = random(0, 10);

    0 <= value && value < 10;