The problem is that I don't want truly random characters; I want characters that are at least a little bit optimized for their purpose. Some examples of the sort of optimization I have in mind:
- a cleric should probably have Wisdom among his highest stats.
- a bard should probably have some ranks in Perform, and should own and use the instrument he can Perform.
- the prepared spells of a wizard expecting combat should favor magic missile over Nystul's undetectable aura.
- a character with weapon focus in a weapon should probably own and use that weapon.
These are all guidelines, not absolute rules. But they're still good ideas that should be generally followed by most NPCs.
I'd really like to have an NPC generator that could follow those guidelines and create reasonably effective PCs. I have no idea how to code such a beast, though--I'm not even sure what all those guidelines are, myself.
One idea for an approach to this problem: genetic programming. But the only evaluation metric I can think of is 'have the characters fight it out and see who wins'. But I don't have nearly the time or energy to write the simulator and the AI that would take.