Java || HashMap || Random Set
If the number from blacklist set has already in the [sz, N), there is no need to map the connection between them. \n\n\n\nclass Solution {\n\n    Map<Integer, I
If the number from blacklist set has already in the [sz, N), there is no need to map the connection between them. \n\n\n```\nclass Solution {\n\n    Map<Integer, Integer> m;\n    Random r;\n    int wlen;\n\n    public Solution(int n, int[] b) {\n        m = new HashMap<>();\n        r = new Random();\n        wlen = n - b.length;\n        Set<Integer> w = new HashSet<>();\n        for (int i = wlen; i < n; i++) w.add(i);\n        for (int x : b) w.remove(x);\n        Iterator<Integer> wi = w.iterator();\n        for (int x : b)\n            if (x < wlen)\n                m.put(x, wi.next());\n    }\n\n    public int pick() {\n        int k = r.nextInt(wlen);\n        return m.getOrDefault(k, k);\n    }\n}\n```
['Java']