✅ C++ |  Simple Solution
\n// idea is to map blacklist numbers with non blacklist numbers\n// now i will generate a random number if that number is in the \n// blacklist i will return a
```\n// idea is to map blacklist numbers with non blacklist numbers\n// now i will generate a random number if that number is in the \n// blacklist i will return a number mapped to this number \n// that is not in our blacklist \n// ex :- n = 7 , blacklist  = {2,3,5}\n//  2 -> 4\n//  3 -> 6\n\n//5 -> 7 this case will never happen because i am limiting\n// the random generated values from 0 - 4 ( n - number of blacklisted)\n\n// now i will pick random numbers from 0 , 4 if\n// that random number is in blacklist i will return the \n// mapped value to that blackedlisted number and the \n// mapped value is not in blacklist \n\n\n\nunordered_map<int,int> mp;\n    int valid_nums=0;\n    Solution(int n, vector<int>& blacklist) {\n        \n        set<int> st;\n        \n        for(auto &x : blacklist) st.insert(x);\n\t\t\n        valid_nums = n-st.size();\n        int idx = valid_nums; \n        \n        for(auto &x:st)\n        {\n            if(x<valid_nums)\n            {\n                while(st.count(idx)) idx++; \n\t\t\t\tmp[x] = idx++;\n            }      \n        } \n    }\n    \n    int pick() {\n        int ans = rand()%valid_nums;\n        \n        if(mp.count(ans))\n            return mp[ans];\n        \n        return ans;\n        \n    }\n```
['C']