#4357
vanilla
Occasionally, maybe 1% of the time a monster spawns during normal gameplay (not during level creation), select a random stair on the map as its spawning location, even if the player can see those stairs. This makes it appear like the monster is arriving from off-level.
However, first scan the stairs and the 8 spaces surrounding it to see if any monsters or the player are there. If so, do not do this and instead spawn the monster randomly like normal.