my python solution
Code\npython3 []\nclass Solution:\n    def __init__(self, m, n):\n        self.m, self.n = m, n\n        self.total = m * n\n        self.flipped = {}\n    \n  
# Code\n```python3 []\nclass Solution:\n    def __init__(self, m, n):\n        self.m, self.n = m, n\n        self.total = m * n\n        self.flipped = {}\n    \n    def flip(self):\n        rand_idx = random.randint(0, self.total - 1)\n        idx = self.flipped.get(rand_idx, rand_idx)\n        self.flipped[rand_idx] = self.flipped.get(self.total - 1, self.total - 1)\n        self.total -= 1\n        return [idx // self.n, idx % self.n]\n    \n    def reset(self):\n        self.total = self.m * self.n\n        self.flipped = {}\n\n```
['Python3']