python solution beats 90%
Intuition\n Describe your first thoughts on how to solve this problem. \nThe problem is to simulate a 2D grid of size m x n and flip a cell at random, with the 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem is to simulate a 2D grid of size m x n and flip a cell at random, with the restriction that a cell can only be flipped once. The solution uses a set to keep track of the cells that have been flipped, and uses the randint function from the random module to generate a random number between 0 and (m*n)-1.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nThe approach is to use a set to keep track of the cells that have been flipped and generate a random number between 0 and (m*n)-1, which represents the index of the cell to flip. If the cell has already been flipped, a new random number is generated until an unflipped cell is found. The index is then used to determine the corresponding row and column of the 2D grid.\n# Complexity\n- Time complexity: O(m*n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(mn)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n\n    def __init__(self, m: int, n: int):\n        self.m = m\n        self.n = n\n        self.total = m*n\n        self.used = set()\n        self.r = random.Random()\n\n    def flip(self) -> List[int]:\n        r = self.r.randint(0, self.total-1)\n        while r in self.used:\n            r = self.r.randint(0, self.total-1)\n        self.used.add(r)\n        return [r//self.n, r%self.n]\n\n    def reset(self) -> None:\n        self.used = set()\n\n# Your Solution object will be instantiated and called as such:\n# obj = Solution(m, n)\n# param_1 = obj.flip()\n# obj.reset()\n```
['Python3']