Stardew Valley : Exits appearance in mines

Solution 1:

I decompiled the source and found that approach 1 is how this was implemented (as of V1.07). When breaking a rock the likelihood of a ladder being placed is inversely proportional to the number of rocks left and directly proportional to the luck level of the player and the daily luck level. When breaking the last block you will have a 100% chance of getting the ladder regardless of the other factors.

Interestingly enough from the quick look I had it seems like the game only intends for a single ladder to spawn this way, but I have also observed multiple ladders spawning when breaking rocks. It looks like this might be a bug, but without really digging into the code it is hard to say if this is actually intended.

As a bonus it looks like there is often (about 95% of the time) an attempt to place a ladder when populating the level, but if the block that is randomly picked is blocked in any way it will not spawn the ladder.