There're also some packages from Bienchen which might help.After many years of trial and error I finally solved this problem. You need three mods:
Zero No Random
Zero Assign NPC Roles
MCCC
Zero No Random is the main mod but unfortunately the author has hidden the mod from download because of player reported issues (mainly role NPCs not showing up when needed). This mod will stop all random NPC generation as long as you manually assign unplayed Sims the roles needed for your game. It takes some time to set all this up since a few dozen Sims need to manually be assigned roles.
MCCC plays a minor role with it's Population settings.
I don't have all expansion packs for the game and so I don't have a complete Zero No Random mod. If no one has the full mod then I'm happy to upload my incomplete version.
Most are in her Mod bundle named "townieoverhaul_lessfame"
Not sure if zero randoms are possible with that but it definitely helps for certain NPC's.
You must be registered to see the links
Right now it was updated last time on 25th February so just scroll to that date or search for "townieoverhaul" in the brower window while visiting the link.