its 2d view right so on the x-y you know where generally coordinates will be in that world. You can then specify specific dungeans etc to be specific places on the map regions, for your main dungeons, the one's you don't want to be randomly placed every time the game starts, which are central to story.
As for random, just use a function to randomize the x-y coords of placement. The numbers you specify can put things into very specific locations or boxes.
place castle( rand(10000, 12000, rand(1000,500) )
so the x and y placement is randomized. But you randomized it within a box, and you know where that box falls within the gameworld.
You can widen your net or box of placement as you see fit. Create an array and loop through it for as many castles as you want.
I really am a simpleton, I am sure someone will come along with a nice algorithm you don't understand