Java Easy solution
\nclass Solution {\n\tHashMap<Integer, Integer> map;\n    Random generator;\n\tint ul;\n\tpublic Solution(int n, int[] blacklist) {\n\t\tthis.generator = new Ra
```\nclass Solution {\n\tHashMap<Integer, Integer> map;\n    Random generator;\n\tint ul;\n\tpublic Solution(int n, int[] blacklist) {\n\t\tthis.generator = new Random();\n\t\tthis.map = new HashMap<>();\n\t\tfor (Integer num: blacklist)\n\t\t\tthis.map.put(num, -1);\n\n\t\tthis.ul = n - blacklist.length;\n\t\tint j = n - 1;\n\t\tfor (Integer num: blacklist) {\n\t\t\tif (num<ul) {\n\t\t\t\twhile (map.containsKey(j)) j--;\n\t\t\t\tmap.put(num, j);\n\t\t\t\tj--;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic int pick() {\n\t\tint random = generator.nextInt(ul);\n\t\tif (map.containsKey(random))\n\t\t\treturn map.get(random);\n\t\treturn random;\n\t}\n}\n```
[]