Mob spawning
Mob spawning is how passive, neutral, and hostile mobs are created in the world.
As new chunks are generated, they have a chance to generate an initial set of mobs from the "creature" category (i.e. most naturally-occurring land animals[A 1]) along with them, ignoring the mob cap, any applicable spawn costs, and the setting of /gamerule spawn_mobs. Any randomness affecting this entire process is derived from the world seed and the position of the chunk that is being generated. Even though biome distribution within the chunk is already known at this point in the generation, the biome of the north west corner of the chunk at the maximum world height is used to make all decisions about this spawning process. As a result, biomes that generate only underground can never affect the initially spawned mobs. Similarly, although structures have been generated already, their potentially configured spawn overrides are ignored. The spawn conditions for most animals prevent them from spawning on "non-terrain blocks", so they won't end up generating on the roofs (or inside) of structures.
The selected biome supplies all relevant mob spawn settings for this process:
Complete article available
This cached Wiki page is unusually large, so it is loaded on demand to keep the initial page fast.