If you just need a quick random sudoku, you can use a particular way of creating a valid sudoku pattern with the following algorithm I figured out a while ago:
You initialize an array with a randomized set of the numbers 1 to 9,
technically it's easier if you initialize 3 arrays each with 3 length.
You can have these numbers be randomized, thus create a different sudoku.
[1 2 3] [4 5 6] [7 8 9]
Then you shift these:
[7 8 9] [1 2 3] [4 5 6]
[4 5 6] [7 8 9] [1 2 3]
Then you shift the numbers inside the arrays:
[3 1 2] [6 4 5] [9 7 8]
Then you shift the arrays themselves again:
[9 7 8] [3 1 2] [6 4 5]
[6 4 5] [9 7 8] [3 1 2]
Then you shift the numbers inside the arrays:
[2 3 1] [5 6 4] [8 9 7]
Then you shift the arrays again:
[8 9 7] [2 3 1] [5 6 4]
[5 6 4] [8 9 7] [2 3 1]
And you'll have the final set of sudoku table:
[1 2 3] [4 5 6] [7 8 9]
[7 8 9] [1 2 3] [4 5 6]
[4 5 6] [7 8 9] [1 2 3]
[3 1 2] [6 4 5] [9 7 8]
[9 7 8] [3 1 2] [6 4 5]
[6 4 5] [9 7 8] [3 1 2]
[2 3 1] [5 6 4] [8 9 7]
[8 9 7] [2 3 1] [5 6 4]
[5 6 4] [8 9 7] [2 3 1]
Which is valid. Afterwards, you can take out some numbers, and you can check with the algorithm you already have whether it has a single solution, or multiple. If removing a certain number produces multiple, then either undo it and end the removal, or try removing another.