public void generate()
    {
        ArrayList<Integer> minePositions = new ArrayList<Integer>();
        ArrayList<Integer> r = new ArrayList<Integer>();
        for (int i = 0; i < (rows * columns); i++) {
            r.add(i);
        }
        Collections.shuffle(r);
        minePositions.addAll(r.subList(0, mines));
        
        for (Integer i : minePositions) {
            map[i] = -1;
        }
        
        for (int i = 0; i < (rows * columns); i++) {
            if (map[i] == -1) {
                continue;
            }
            map[i] = countSurroundingMines(i);
        }
    }