[Intuitive] Algorithm Explanation Step By Step.
Description\nWe will be using modern method of the Fisher\u2013Yates shuffle.\n\nPlease read how the original algorithm works: Examples.\n\nOverview\n generate 
**Description**\nWe will be using modern method of the Fisher\u2013Yates shuffle.\n\nPlease read how the original algorithm works: [Examples](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Examples).\n\n**Overview**\n* generate random from 0 to n : m\n* swap m and n\n* decrease n\n\n**Implementation**\n```java\nclass Solution \n{\n    private Map<Integer, Integer> map;\n    private int rows, cols, total;\n    private Random rand;\n    \n    public Solution(int n_rows, int n_cols) \n\t{\n        map = new HashMap<>();\n        rand = new Random();\n        rows = n_rows; \n        cols = n_cols; \n        total = rows * cols;\n    }\n    \n    public int[] flip() \n\t{\n        // generate index, decrease total number of values\n        int r = rand.nextInt(total--); \n\t\t\n        // check if we have already put something at this index\n        int x = map.getOrDefault(r, r); \n\t\t\n        // swap - put total at index that we generated\n        map.put(r, map.getOrDefault(total, total)); \n\t\t\n        return new int[]{x / cols, x % cols}; \n    }\n    \n    public void reset() \n\t{\n        map.clear();\n        total = rows * cols; \n    }\n}\n```
[]