simple, short and clean  java solution
we are using tree map to increase the chance of selecting a rectangle with larger area, then selecting a point in its area randomly.\n\nclass Solution {\n    in
we are using tree map to increase the chance of selecting a rectangle with larger area, then selecting a point in its area randomly.\n```\nclass Solution {\n    int[][] rect;\n    TreeMap<Integer,Integer> tm=new TreeMap<>();\n    int sum=0;\n    Random ran=new Random();\n    public Solution(int[][] rects) {\n        rect=rects;\n        for(int k=0;k<rects.length;k++){\n            sum+=(rect[k][2]-rect[k][0]+1)*(rect[k][3]-rect[k][1]+1);\n            tm.put(sum,k);\n        }\n    }\n    public int[] pick() {\n        int k=tm.get(tm.ceilingKey(ran.nextInt(sum+1)));        // sum can also be picked\n        int x=ran.nextInt(rect[k][2]-rect[k][0]+1)+rect[k][0];\n        int y=ran.nextInt(rect[k][3]-rect[k][1]+1)+rect[k][1];\n        return new int[]{x,y};\n    }\n}\n```
[]