JAVA Without Using HashSet
Simplfied version:\n```\n class Solution {\n    Random random;   \n    HashMap map;\n    int size;\n    public Solution(int n, int[] blacklist) {\n        map =
Simplfied version:\n```\n class Solution {\n    Random random;   \n    HashMap<Integer, Integer> map;\n    int size;\n    public Solution(int n, int[] blacklist) {\n        map = new HashMap<>();\n        size = n - blacklist.length;\n        random = new Random();\n        //We put the blacklist\'s elements into the map first.\n        for(int i : blacklist){\n            map.put(i, -1);\n        }\n        int last = n - 1;\n        for(int i : blacklist){\n            //If current element exceed the size, we do not need to switch it with the last element.\n            if(i >= size){\n                continue;\n            }\n            //If map contains the last element, it means it is in the blacklist, so we need to skip it.\n            while(map.containsKey(last)){\n                last--;\n            }\n            map.put(i, last);\n            last--;\n        }\n    }\n    \n    //We can use getOrDefault method to get the value or the current number\n    public int pick() {\n        int index = random.nextInt(size);\n        return map.getOrDefault(index, index);\n    }\n}
[]