Function randomInt

  • Generate a random integer 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 integer within the given bounds

    Math

    randomInt(0, 3); // 0, 1, or 2