I have also fancied making a map randomiser, which would set #poptypes, defenders etc depending on terrain and other features.
I also hoped to have it allow different settings, like equivalents of randomly equipping independent commanders with items from custom lists (no Snake Bladder Sticks or Bane Venom Charms), choosing random special provinces (group of Abysians and Salamanders guarding a Mountain province with a Volcano) and generating kingdoms (1 "capital" province with special provinces, defenders and sites (2 lizard Shamans, 3 Barbarian Commanders, Lizards, Barbarians, few Tribal Archers and Warriors, few Horse Brothers) with themed neighbours near it (normal Barbarians, Lizards, Tribal warriors/archers with Shamans in addition to the other commanders).
I think many have dreamed of having such a program. It can be done independently on a map creator. No one has managed to get a map
graphics creator this far, AFAIK. Even if the other plans for map randomizer have failed, I think you should first get the map creation part working. Add the other stuff after that.
BTW, you might've quessed that my map randomizer isn't complete.

In fact, it does almost nothing; it might be able to write few correct # lines, but even that doesn't yet work. However, I have free time until June, and even after that I have most of the summer and autumn to myself... I just haven't programmed for half a year.