OP: generating and solving sudokus are two completely different tasks. Probably best to work on a solver first, then once you've got the hang of that, turn the rules round to make a generator. You can generate them randomly, but it's probably more efficient in the long run to use the rules "backwards" to generate a puzzle.