@Override
    public SudokuBoard getProblem(){
        final SudokuBoard board = new SudokuBoard(brd);
        ArrayUtil.shuffle(cells);
        int pos = 0;

        while (true){
            int cell;
            CandidateSet options = null;
            do {
                cell = cells[pos];
                pos = (pos + 1) % cells.length;
                if (!board.isSet(cell)){
                    options = board.getOptions(cell);
                }
            } while (board.isSet(cell) || options.cardinality() <= 1);

            int value = options.getRandomValue();
            board.setCell(cell, value);

            int form = SolverService.getFormity(board);
            if (form == SudokuSolver.NO_SOLUTIONS){
                board.clearCell(cell);
            }
            else if (form == SudokuSolver.UNIQUE_SOLUTION){
                break;
            }
        }

        //try removing additional values
        for (int cell : cells){
            if (board.isSet(cell)){
                int value = board.getCell(cell);
                board.clearCell(cell);
                int form = SolverService.getFormity(board);
                if (form != SudokuSolver.UNIQUE_SOLUTION){
                    board.setCell(cell, value);
                }
            }
        }

        return board;
    }