Hm, that's a good question. It's a little difficult, though, because "buildings," by definition, are not random. They are planned and constructed with a specific purpose purpose in mind, whether it be residential, industrial, or commercial.
So, the most logical solution would be to choose a "purpose" for the building, find out what is needed to fulfill that purpose, and put it into a building.
Say, for example, you wanted a residential building. You determine that for a good residential "feel," you need at least 200 sqti (square tiles, like square feet, but instead of feet, you use tiles to measure) of space. So, your building is something like 10x20 or 20x10 or 20x20 or anything that gets you at least 200 sqti. You could also slap X amount of rectangles together, whose total sqti is at least 200 sqti, giving you L- or U- or H- or some-other-letter-shaped houses. Then, you figure a residential space needs at least one bedroom, bathroom, kitchen, dining room, patio, etc. So, within your 200+ sqti, you put in at least one of those things; maybe limit the kitchen/dining room/patio to only one (no need for 3 kitchens!). Of course, each type of room also has unique furniture/appliance needs, as there's no need for an oven in the bedroom. So put the right furniture/appliances in the right rooms, polish it up, and voila! Nice, random (yet structured) residential buildings.
You can do the same with commercial (cubicles, offices, bathrooms, janitor closets, etc) and industrial (factory floor, bathrooms, maybe one office, control-room-type-thing, etc).