The position of all the mines is set before your first click. If your first click is over a mine, that mine will be moved to the top left corner instead. If there is already a mine there, it will go one square to the right, and so on.

In early releases of Minesweeper on DOS-based Windows kernels, Beginner boards were 8x8 but one-click games were not normally possible. This is because boards were not generated from the entire space of legal boards but from a couple of small cycles which only generated 48,624 distinct boards under normal conditions. However, boards could be changed using the method mentioned above. In extremely rare cases, it is possible to change a board into a one-click board on which your first click is a solution, leading to the

One Click Bug. There were also other ways to force nonstandard boards by opening two games simultaneously, but that's not really relevant here.

For releases on OSes with NT-based kernels and third-party clones, a much more sophisticated PRNG is used and a far larger of number of boards is possible. It is unknown however if every legal board is possible or if all possible boards are equally probable. In particular, clicking on a mine still moves that mine to the top left corner, ultimately making boards with a mine or multiple mines at the far left of the top row more likely than other boards. This should increase the probability of one-click games somewhat, and the page linked above gives two examples of one-click Beginner (9x9) games on XP, one "natural" game in which no mine was moved to the corner, and another "bugged" game in which a mine was moved to the corner, causing the timer bug.

The exact board you showed below is only one single board, so if the program uses a properly distributed RNG, the probability of it occurring discounting symmetry or anything else is simply the reciprocal of the number of boards. In this case, it is Expert, 16x30=480 squares with 99 mines, so the number of possible boards is simply

n = 480 choose 99 = 480!/(99!(480-99)!) = 560220999337421345429058985775821108059290502723897901281458809527214479570631168198385673295159633481600 ≈ 5.6 × 10

^{104}. Since this board cannot be generated by moving a mine but must arise naturally, the probability that it arises is 1/

n ≈ 1.8 × 10

^{-105}.

However, actually

winning this board in one click depends where you click. For example, if you click in the bottom left corner, you will simply get a 3, moving the mine to the top left, and giving you a decent shot of simply losing on your next click. Clicking on any mine or on any number will not win immediately. Thus only 360 of the 480 spaces result in a one-click win, meaning if you play a randomly generated board and click a random space, your probability of winning

with this particular board is 3/(4

n) ≈ 1.4 × 10

^{-105}.

A more interesting question though is how many one-click win boards there are. Discounting first-click mines, this should be computable, though I'm not exactly sure how to go about it. Counting first-click mines makes it even more complicated.

EDIT: The board you posted is 16x31, which is super weird. Expert boards are usually 16x30 with 99 mines for modern purposes, or 24x30 with 200 (or 225) mines for super-expert. Anyway, for the 16x31 board, instead of 480 choose 99 boards, there are 496 choose 99 boards, or 2.1 × 10

^{106}, as above. Therefore the probability of getting that exact board before clicking is (480C99)

^{-1} = 4.8 × 10

^{-107}, and to win on the first click with that exact board is 376/496 = 47/62 ≈ 0.76 times as much.