A lot of advice for running sandbox campaigns talk about creating lots of material beforehand, for example lists of NPCs for players to interact with. This is a rather heavy workload, of course, so one of the other options is to use a random table. But there's very little advice for making such tables, and the example tables seem to mostly be just list of NPCs, sometimes a hundred different NPCs in a d100 table. Even that's not going to last forever, and you'll be back where you started: needing to make a table.
The opposite random tactic is to have tables of traits, skills, beliefs, and so on, to roll up each NPC. This can get bogged down, so it might be wiser to use a shortcut: create a small list of NPCs, say six, twelve, or twenty, and create the rest by multiplying those starter NPCs. What I mean by that is mixing parts of two NPCs to make a third.
Let's illustrate this with just six NPCs and just the standard ability scores to start. You roll up six seed characters, exactly as if you were creating an adventure party:
1. Str 16 Int 13 Wis 16 Dex 6 Con 12 Cha 15
2. Str 11 Int 7 Wis 4 Dex 18 Con 17 Cha 15
3. Str 14 Int 4 Wis 13 Dex 12 Con 13 Cha 13
4. Str 11 Int 14 Wis 11 Dex 7 Con 9 Cha 5
5. Str 9 Int 7 Wis 3 Dex 9 Con 6 Cha 9
6. Str 3 Int 9 Wis 5 Dex 8 Con 7 Cha 6
You get a list of names, lots of names, maybe first and last name pairs. Write them on a sheet in rows and columns, for example three columns and 20 to 30 rows. You're going to use this as a drop dice table to roll random names.
Drop 2d6 on the table. Take the first name from wherever the lowest d6 lands, the second name from where the other die lands.If they tie, read from left to right on odd results, right to left on even.
For the second part of making the character, read the d6 results from left to right, looking up each result on the table of ability scores. The first d6 is the first three ability scores from your seed characters, the second d6 is the second three scores. That's 36 possible characters.
It can get more complicated. Label the first four seed characters Fighter, Magic-User, Cleric, Thief, the last two as Merchant and Laborer. Roll a d6 for the class of common characters, a d4 when recruiting henchmen.
Or make a list of twenty random characters/ Label the first four Fighter, the next three Thief, the next two M-U, the tenth as a Cleric, and the rest as a mix of laborers and merchants. Or mix up the proportions to fit your preferred distribution. On your drop dice sheet of names, add one word traits to some or all of the names: Cruel, Gullible, Stubborn, whatever you wish. Roll 3d20 and interpret in order as first name, last name, trait (by position) and class, first three abilities, last three abilities (by value.) That's 2,000 mechanically distinct characters, with 8,100 possible names and a mix of personality traits.
Create a different list of names for each culture. If the proportions of classes change from region to region, you can change the seed character table, too. Endless character combos for your world.