No TreeMap, Use Reservoir Sampling Java Solution, One Pass
\nclass Solution {\n    Random random;\n    int[][] rects;\n    public Solution(int[][] rects) {\n        random = new Random();\n        this.rects = rects;\n 
```\nclass Solution {\n    Random random;\n    int[][] rects;\n    public Solution(int[][] rects) {\n        random = new Random();\n        this.rects = rects;\n    }\n    \n    public int[] pick() {\n        int sum = 0;\n        // the idx of rect that will be selected\n        int idx = 0;\n        for (int i = 0; i < rects.length; i++) {\n            int[] r = rects[i];\n            int w = r[2] - r[0] + 1;\n            int l = r[3] - r[1] + 1;\n            // count of points\n            int count = w * l;\n            sum += count;\n            if (random.nextInt(sum) < count) idx = i;\n        }\n        \n        int x = rects[idx][0] + random.nextInt(rects[idx][2] - rects[idx][0] + 1);\n        int y = rects[idx][1] + random.nextInt(rects[idx][3] - rects[idx][1] + 1);\n        \n        return new int[] {x, y};\n    }\n}\n```\n
[]