reasonable python3 solution, sort O(BlogB) + binary search O(logB)
\nclass Solution:\n    \n    def __init__(self, N, blacklist):\n        """\n        :type N: int\n        :type blacklist: List[int]\n        """\n        self
```\nclass Solution:\n    \n    def __init__(self, N, blacklist):\n        """\n        :type N: int\n        :type blacklist: List[int]\n        """\n        self.N = N\n        self.blacklist = blacklist\n        self.blacklist.sort()\n\n    def pick(self):\n        """\n        :rtype: int\n        """\n        \n        import random\n        \n\t# we have N numbers and len(blacklist) is blackedout, so effectively we are randomly picking one number out of M numbers\n        M = self.N-len(self.blacklist)\n        r = random.randint(0, M-1)\n        \n\t# use binary search to find the maximum index from blacklist such that blacklist[index] < r + index + 1\n        start=0\n        end=len(self.blacklist)-1\n        while(start<=end):\n            mid=start+(end-start)//2\n            if self.blacklist[mid] < r+mid+1:\n                start=mid+1\n            elif self.blacklist[mid] >= r+mid+1:\n                end=mid-1\n            \n        return r+start\n```\n\nQuestion: how does leetcode judge random results? If solution accepted, does it mean uniform distribution is achieved?
[]