The Binding of Isaac with the Wrath of the Lamb expansion has two different secret rooms on each floor. It seems that there are some specific rules that determine where the rooms can appear on the map. What are those rules?
Looks like somebody on Steam forums decided to answer this question and to use SCIENCE! while doing it.
To put it simply he divides the room in four categories(he calls hidden rooms those that in my other answer I called Top Secret Rooms):
So, basically, every floor is generated randomly, then the hidden room takes the place of one of the normal terminators, then the secret room is put into place, AFTER all of the other rooms have been placed. Please note that the floors have a size limit: the map will never be bigger than 9x6 tiles (width x height). Also every floor has its specific room number:
While I disagree with the completely random placement of the secret room (he says that every wall is rolled randomly to see if it connects to a secret room), his theory is pretty sound, and applies quite well with what we already know about the behaviour of hidden and secret rooms.
Secret rooms instead are generated in a completely different way from the other rooms. Secret rooms are placed after the rest of the level has been created. Vimescarrot, the creator of the post on Steam forums, proposes the idea that ANY wall can lead to a secret room:
However, I disagree with this idea. In ~400 runs I have NEVER found a secret room near a single wall, and the only times I've found them near only two walls was when there were no available 3 or 4 rooms spaces. This seems to me a big enough sample to be quite sure of what I've found.
Whichever idea you'll follow anyway, it will be more likely to find secret rooms in spaces surrounded by many other rooms.
The secret rooms too will follow the 9x6 rule, so any wall leading out of the grid can be safely left unbombed.
Differently from hidden rooms, there are many items that can help you find secret rooms: the Sun and the World tarot cards, the Map and the Crystal Ball show you the current level map layout, including the secret room. Spelunker hat and X-ray Vision work as well.
PAY ATTENTION: Curse of the Labyrinth completely messes up all these rules. To put it in Vimescarrot words:
Until now nobody has been able to find a pattern in level generation with Curse of the Labyrinth. If you happen to find by chance a secret room in one of those levels, it can be filled with enemies(from my experience I can tell that it WILL be). If you're low on bombs and don't have X-ray Vision get the hell out of there through the exit you came in: if you bomb one of the other walls you may find yourself on the other side without a way to end the level.
By the way, basing on a small sample(2 runs), it looks like that, similarly to shop rooms, an XL level will only have one secret and one hidden room each.
The hidden room also counts as a border for the secret room, considering that it is just converted terminator. Secret rooms that are only bordered by two normal rooms are also connected to the hidden room.