Concise c++ solution. Faster than 88%.
Used Merssine Twister (mt19937) instead of rand.\n\n\n#include <random>\n\nclass Solution {\npublic:\n\n    unordered_map<int, int> swaps;\n    const int r, c;\
Used Merssine Twister (mt19937) instead of rand.\n\n```\n#include <random>\n\nclass Solution {\npublic:\n\n    unordered_map<int, int> swaps;\n    const int r, c;\n    const int total;\n    int avail;\n    mt19937 mt_rand;\n    \n    Solution(int m, int n) : r(m), c(n), total(m*n) {\n        avail = total;\n        mt_rand = mt19937(time(NULL));\n    }\n    \n    vector<int> flip() {\n        int chosen = mt_rand() % avail;\n        while(swaps.count(chosen)) {\n            chosen = swaps[chosen];\n        }\n        int toswap = avail - 1;\n        while(swaps.count(toswap)) {\n            toswap = swaps[toswap];\n        }\n        swaps[chosen] = toswap;\n        avail--;\n        return vector<int>{chosen / c, chosen % c};\n    }\n    \n    void reset() {\n        swaps.clear();\n        avail = total;\n    }\n};\n```\n
[]