can I beg to differ here TDK?, you can use a matrix for a ceiling, cave-run does, I have as well, it works ok, as for the rooms inside the building thing, thats simple, just make some wall-like boxes, turn half of them through 90deg, position them at random making sure none of them hit one another and they are not too close together, eg:
repeat
position object obj,x,y,z
position object prox,x,y,z
until object collision (obj,0)=0 and object collision(prox,x,y,z)=0
then make them shorter by the width of two doors, so if the walls are too close together at the ends then when you shorten em a door sized opening is made, the prox object is the same length as the wall object but as wide as two corridors, so that a wall can not be placed parallel right next too another so close you can`t walk between them, hey presto, simple room creation with guaranteed exits and no inaccesable spaces, just remember to delete or re-use the prox object after every placing or the next loop of the routine will detect the prox object as well and mess up, if you want just one end to have a door sized gap then you could resize to just a doors width shorter and reposition the wall 1/2 that distance to the left or right (seen from the walls perspective), that gives just one opening per wall, or if you want the doorway to be in the middle of the wall then after you have found a valid position, delete that wall object and make two that will occupy the same area but have an opening in the middle, you just need to fiddle a bit to get the right amount of walls inside the area to look decent.
if there is one thing I can NOT tolerate, it`s intolerant people.