I want to generate random sudoku grids.
My approach is to fill the three 3x3 groups on a diagonal of the grid, each with the numbers 1-9 randomly shuffled. That looks e.g. like the grid below:
+-------+-------+-------+
| 5 6 4 | · · · | · · · |
| 1 7 2 | · · · | · · · |
| 9 8 3 | · · · | · · · |
+-------+-------+-------+
| · · · | 3 2 5 | · · · |
| · · · | 7 9 6 | · · · |
| · · · | 8 1 4 | · · · |
+-------+-------+-------+
| · · · | · · · | 1 5 9 |
| · · · | · · · | 3 2 7 |
| · · · | · · · | 6 4 8 |
+-------+-------+-------+
Then I let my sudoku solver process it until it finds a solution to fill all remaining gaps. The example above resulted in the filled grid below:
+-------+-------+-------+
| 5 6 4 | 9 3 7 | 2 8 1 |
| 1 7 2 | 5 4 8 | 9 6 3 |
| 9 8 3 | 1 6 2 | 4 7 5 |
+-------+-------+-------+
| 7 4 9 | 3 2 5 | 8 1 6 |
| 2 1 8 | 7 9 6 | 5 3 4 |
| 6 3 5 | 8 1 4 | 7 9 2 |
+-------+-------+-------+
| 8 2 6 | 4 7 3 | 1 5 9 |
| 4 5 1 | 6 8 9 | 3 2 7 |
| 3 9 7 | 2 5 1 | 6 4 8 |
+-------+-------+-------+
My question is if this approach is mathematically safe, i.e. can you prove me that when I fill my grid using the described approach (randomly assigning the first 27 numbers to fields in the groups on a diagonal line), there will be always at least one possible way to complete the grid from there on?
Or are there chances that the randomly placed numbers can interfere with each other and result in an impossible grid?