Python 3 Weighting by area
I am a bit baffled by this problem in particular and how leetcode judges problems involving randomness in general. The code below selects a rectangle at random 
I am a bit baffled by this problem in particular and how leetcode judges problems involving randomness in general. The code below selects a rectangle at random weighted by its area. This is necessary because to select some point with uniform probability means the selected point is more likely to land in a rectangle with a larger area. \n\nThe following code contains an error.\n```\nimport random\nclass Solution:\n\n    def __init__(self, rects: List[List[int]]):\n        self.rects = rects\n        self.areas = [abs(r[0]-r[2])*abs(r[1]-r[3]) for r in rects]\n\n    def pick(self) -> List[int]:\n        rect = random.choices(self.rects, weights=self.areas)[0]\n        return [random.randint(rect[0], rect[2]), random.randint(rect[1], rect[3])]\n```\n\nBut when I make the subtle correction `self.areas = [(abs(r[0]-r[2])+1)*(abs(r[1]-r[3])+1) for r in rects]`, the code passes all test cases. :-/ It\'s horrendously slow in comparison to binary search, but it works.
[]