Python Random choices with weights
\n(x2-x1+1)*(y2-y1+1)  stands for the number of points in rectangle [x1,y1,x2,y2]. So with the weights, we can ensure for every point the chance of being picked
\n(x2-x1+1)*(y2-y1+1)  stands for the number of points in rectangle [x1,y1,x2,y2]. So with the weights, we can ensure for every point the chance of being picked is evenly.\n\n```\nclass Solution:\n\n    def __init__(self, rects: \'List[List[int]]\'):\n        self.rects_weight = []\n        self.rects = rects\n        for [x1,y1,x2,y2] in rects:\n            self.rects_weight.append((x2-x1+1)*(y2-y1+1))\n        \n    def pick(self) -> \'List[int]\':\n        [x1,y1,x2,y2] = random.choices(self.rects, weights = self.rects_weight)[0]\n        x = random.randrange(x1,x2+1)\n        y = random.randrange(y1,y2+1)\n        return [x,y]\n```
[]