C# easy solution
Code\n\npublic class Solution\n{\n    private readonly int _m;\n    private readonly int _n;\n    private Dictionary<int, int> _d;\n\n    private int _count;\n\
# Code\n```\npublic class Solution\n{\n    private readonly int _m;\n    private readonly int _n;\n    private Dictionary<int, int> _d;\n\n    private int _count;\n\n    public Solution(int m, int n)\n    {\n        _m = m;\n        _n = n;\n        Reset();\n    }\n\n    public int[] Flip()\n    {\n        var rand = Random.Shared.Next(_count);\n\n        int[] res;\n\n        if (_d.TryGetValue(rand, out var value))\n        {\n            res = [ value % _m, value / _m ];\n        }\n        else\n        {\n            res = [ rand % _m, rand / _m ];\n        }\n\n        _count--;\n\n        if (_d.TryGetValue(_count, out int valueM))\n        {\n            _d[rand] = valueM;\n        }\n        else\n        {\n            _d[rand] = _count;\n        }\n\n        return res;\n    }\n\n    public void Reset()\n    {\n        _count = _m * _n;\n        _d = new();\n    }\n}\n```
['C#']