Minecraft – How are dungeons in minecraft generated

minecraft-java-edition

While looking through my map using MCEdit, i found a double dungeon (interconnected). After searching for a while on the internet i found out that it was extremely rare. How are these dungeons generated and what are the possibilities of 2 or more dungeons being interconnected to each other?
double dungeon which i found

Best Answer

When a chunk is populated, the dungeon generation is always tried 8 times independently at random positions in the chunk. For each generation, given a random size (5x5, 5x7, or 7x7, excluding walls), a dungeon is generated only if the ceiling and floor blocks are solid and there are 1~5 air blocks in the lower half of the surrounding walls.

Possibility? That's complicated to calculate because the probability distribution of air blocks is more complicated and that depends on this. However, you can certainly qualitatively assert that double dungeon is rare. I assert the existence of triple dungeon.