I guess it's based on random number generator, but when does the engine generate new floors? Just before entering the trapdoor, during the animation or during the cutscene? Or maybe are all floors generated at the beginning? Same thing goes for items in item rooms and shops. Are they based on frame number, RNG, or preset during level generation?
"rooms are generated when you start a level, but the random aspects of each room are generated when you go inside the room. also the drops that come from killing enemies and rocks are generated when you kill said enemies/rocks"
-From Edmund Mcmillen's Formspring.