Easy Java with a List
\nclass Solution {\n    int area = 0;\n    List<Integer> list = new ArrayList<>();\n    int[][] rects;\n    public Solution(int[][] rects) {\n        this.rects
```\nclass Solution {\n    int area = 0;\n    List<Integer> list = new ArrayList<>();\n    int[][] rects;\n    public Solution(int[][] rects) {\n        this.rects = rects;\n        for (int[] rect : rects) {\n            area += (rect[2]-rect[0] + 1)*(rect[3] - rect[1] + 1);\n            list.add(area);\n        }\n    }\n    \n    public int[] pick() {\n        Random r = new Random();\n        int rand = r.nextInt(area) + 1, i = 0;\n        while (list.get(i) < rand) i++;\n        int[] cord = rects[i];\n        int num = list.get(i) - rand, width = cord[2] - cord[0] + 1;\n        return new int[]{cord[0] + num%width, cord[1] + num/width};\n    }\n}\n```
[]