The most important aspect of an NPC is presenting a persona that the players can interact with realistically and consistently.
Stats will not do that - they'll help and give you guidance on what a character can and can't do, and for some GMs (and possibly systems, but that's debatable) that is essential - but it's not required.
Believe me, I generated dozens of 20+ level NPCs for Rolemaster for my campaign before I realised this, I only wish I'd known it sooner.
Ad-libbing
A very very helpful skill with NPCs, but try to avoid NPC growth; like suddenly giving an NPC a skill that are exactly right for the situation that they're in, that they wouldn't have. Now and again drop a skill on them maybe (and note it down, always note what you add or change) but not always. The players are the "do-ers" not the NPCs.
Sticking to the rules
Do stick to the rules for your NPCs, one or maybe two can have some kind of exceptional skill or ability - but make this a special, if you litter your NPCs with things that are "impossible" to the rules, you'll just nark your players off when they realise this, and they will.
What do you need then?
All you need is as much of a summary of the NPC on a card or a sheet that you can keep the NPC consistent with what the players have seen before.
Personality. Write down what the NPC is like, their persona, their quirks and a couple of likes/dislikes. This is what players interact with.
Appearance. You don't need to write a saga and not every NPC needs to stand out; but one or two appearance quirks that players remember define an NPC. "Ah, it's Bob the wizard, he always wears that battered old green hat."
Stats; scribble down a few critical stats for them if you really need; for AD&D it'd be things like HP, AC and a couple of skills and attack bonus if they're going to hit someone. Combat based characters may need full fleshing out, but Bob the Shopkeeper doesn't need any of that.
Skills/Perks; mostly like stats; make a note of a couple of key skills and either their level/rating/bonus/etc or just a word description and one obscure (hobby) skill for the NPC. "Bob the Shopkeeper, Bargain +10, Rumourmonger +8, Taxidermy +6". The hobby skill gives the NPC something to talk about.
Relationships; who the NPC likes and dislikes and also any events that have happened with (or without) the players that are significant to the NPC. You don't need full details either, just a short phrase to kickstart your own memory about what happened. Like "Bob gave Fred magic sword as thank you for putting out fire"
That's it, that's all I roll with now and that's what keeps the NPCs alive; you need to make them convincing, not detail to the Nth degree - I've found that to actually be more limiting for them and not to mention time consuming!
Major NPCs
These are worth detailing in full - or at least a lot more detail, again especially for combat based NPCs; these are your major supporting cast to the story and I take more time and detail in these NPCs as well as adding more background, really just fleshing out what I've put above.
Well, I hope they're not going into a genuinely random building. Just barging into somebody's house isn't likely to get much in the way of a friendly reaction, but if the PCs say "oh, I want to walk down this street" or "oh, that sounds like an interesting shop" or are otherwise pointing themselves in a sensible direction, and you haven't completely planned what's there? Sure, why not be random?
0) Random For What
But first you should have some idea what you want out of it. Everything you do should reflect off of some goal that either you or the PCs have.
Not just entering some random building for the sake of it, but, you know, looking for something particular to buy, fishing for useful rumors, that kind of thing.
And make sure this isn't something that would be covered just by, say, rolling Discern Realities and asking. Just finding a solid weapon store in an unfamiliar town would certainly be useful or valuable to you, but there's still the question of how the blacksmith is going to feel about you when you get there.
1) Random For How
So, yes, as the GM you never roll dice to make moves. Your antagonists will never be able to roll dice, consult the rules, and just make things happen without the PCs say-so. You can't roll for outcome.
Nobody ever said anything about rolling for intent, though.
That's the purpose of things like the Fourth Page Tables, so named because the stripped-down World of Dungeons version of Dungeon World only had three pages of rules. Need a prompt to keep going? Pick up the City page, roll on Population or Society, and work that idea into the situation that's already established. Or, you know, when you're looking over the list or looking up the die roll, if you see something that speaks to you, you can just use that instead. The purpose of the thing is just to give you ideas, not present some random and absolute balance.
2) Random For Why
But always keep in mind, whatever random prompting method you're using? The players were looking at you to find out what happens. So once you've got your prompt, use that prompt to feed into the GM move you lob back to them.
Let's take the simplest prompt mechanism, the one I'm absolutely sure you will have at your table: The Die Of Fate. Disguised as a humble d6, when you find yourself in need of a prompt, consider a question and roll the Die of Fate for an answer.
So, Die of Fate, is this armorsmith going to be favorably-disposed enough to the PCs to work on their armor?
6: Yes, and. Oh, there's something more? Hmm. Let me offer an opportunity that fits a class's abilities.
Clericsdottir, you mentioned your helmet was a particular make specific to the God of Craft? The smith recognizes it and her eyes light up. She makes the sign of the Turning Gears out of respect. She says it's been so long since one of the Faith has visited. ...that's kind of odd for a town this size, but you can worry about that later. You must have a lot going on, but please, sister, can you bless her tools?
Now, that's usually a pretty simple ceremony, but then people usually only have a small number of tools. Big shop like this, it'd tie you up for a whole day to do it proper, but if it's really been that long since she's had a blessing, you could also get quite a few favors out of her in return. Or you could sprinkle a little blessed water and make the sign of the Just Working in the appropriate places. That'd be the least expected of you.
5: Yes. Easy enough. Tell them the requirements or consequences and then ask.
Fletcher, you like going in first, right? Well, the smith sizes you and Rockjaw up and the people following you and grins. You're the sort of people who need the serious work done, he says, which is excellent, as he's the sort of person who likes to make serious coin for serious work.
Custom work on armor takes at least 50 coin and some time without the armor to finish the work. We can talk about the sorts of modifications you'd like once you all work out how much you're willing to spend.
4. Yes, but. It can happen right now, but there's a catch. What kind of catch? ...hmm, I think in this case I'll use up their resources.
When you ask after a hidden compartment in the armor for your poisons-I-mean-medicines, Shanksworth, the smith looks at you and flashes a quick and furtive sign. You get the gist of what's going on here but the countersign doesn't come to mind, sorry.
No can do, he says. He's got other priority projects right now. He thinks for a moment. Of course, if you were willing to pay an expedited processing fee, that might change.... This is going to be a significant bribe, let's call it 65 coin on top of the 50 for the custom work.
3. No, but. So it's not an option right now, but it could be. What's in the way? Hmm. I think I'll show signs of an approaching threat.
The smith looks kind of hopeful as you look over the stuff on offer, Sir Justice, but when you ask about getting some sealants for your armor to protect against noxious vapors, her face falls. She's sorry, she says, but she can't do that. She glances significantly at the wooden icon hanging by her doorway -
looks like a long shield with crossed spears behind it. Not now, she says.
Huh. Come to think of it, you did see that sign hanging in quite a few of the market stalls on the way here. And on the armor of a few of the bravos strutting around like they owned the place. What are you doing?
2. No. Alright. But I don't want to just stonewall them, as much as provide a path forward... ah. I'll reveal an unwelcome truth.
You put on your best smile, Stringfellow, but she seems to be wrapped up in her work, and the second you broach the topic of a custom job she shuts you down, flat.
Not with the war on, she says. Captain Runcible has everybody going full-time to arm the militia. First you've heard of war. You might be able to finagle some permission out of the Captain, but it might be more important right now to chase down some information. What are you doing?
1. No, and. Hmm. I don't want them to get immediately violent, but what can I- ah! Show a downside to their class, race, or equipment.
You ask if he does custom work, Fightgar, and he grins and invites you around the counter - but as soon as you're clear of the display racks and he catches sight of your clan-braids his face goes hard. But not for you, he says. Get out. Stonehammer gold's no good here.
Oof. Your clan reputation's come into play before but never this hard. Can you think of anybody with that kind of grudge against the clan, Fightgar? Obviously he knows what's going on, but you get the feeling asking might just make it worse. What are you doing?
Best Answer
First, a caveat.
There are no rules, per se, to tell you how to do what you want to do. You mention the DMG, which does have section on customizing monsters, including ideas like what I suggest here. (It also has a section on building encounters.) However, the systems in the DMG take time and thought, and you're asking for a quicker, dirtier method. So while I would certainly encourage you to internalize the DMG's guidance, what I am presenting here is a method for use on the fly. It is all based on personal experience.
For what it's worth, I have used both of the two approaches I offer here while running, e.g., Adventurer's League modules for tables of anywhere from 2 to 8 players, never knowing exactly how many I'll have.
Option 1: Scale the number of foes.
The single easiest method to scale 5e encounters is to focus on the action economy. In 5e's fine-tuned mechanics, whichever side gets to act more often has a major advantage. That is the reasoning behind, e.g., the legendary actions that some big solo threats in the Monster Manual have -- it's hard to make a solo threat, even a "big" one, feel truly threatening if it is totally outnumbered by the PCs. The very fact that it is outnumbered and unable to act as often as the PCs act means it's likely to get walloped. Legendary actions help to level the playing field.
By the same reasoning, you can make an encounter workable for a variable number of PCs simply adjusting the number of foes they'll face. More foes equals more actions equals more challenge. It's not a foolproof approach; some monsters have abilities that make them disproportionately difficult as their numbers increase. (Quick example off the top of my head: monsters with Pack Tactics get advantage if an ally is within 5 feet of their target, so the more of them there are on the field, the more likely it is they'll have advantage on any given turn.) But this approach does have the advantage of requiring essentially zero additional preparation. If you're writing an encounter with, say, zombies, you're only preparing zombies whether it's 2 or 5 or 20.
A very general rule of thumb is to pit the PCs against an equal number of foes, adding or subtracting 1 or 2 if the foes are very weak or very strong, respectively.
Option 2: Scale defenses, particularly AC, saves, and HP.
Sometimes adjusting the number of foes isn't feasible or desirable. Maybe you have in mind an encounter against a big solo monster or some specific named NPC. In that circumstance, your best bet is to scale defenses.
Combat is, in a sense, a zero-sum game. The longer it takes you to defeat a foe, the more chances (i.e., turns) that foe has to defeat you first. The PCs' offensive capabilities are generally a known quantity in a given encounter. You'll know roughly how much damage the raging barbarian's axe or the wizard's fireball is likely to do. By tweaking their foe's defenses upward, you'll buy the baddies a little additional time to be relevant before they're beaten.
However, be careful not to adjust those defense figures too much. The "bounded accuracy" model underpinning 5e's mechanics makes a +1 to AC meaningful. I have found that adjusting HP by 10-20% per extra/missing PC is generally workable. It is enough to make the difference palpable but not overwhelming. YMMV, of course.
You might be tempted to also adjust the foe's offenses upward. Unless you are really trying to either clobber or coddle your PCs, resist that temptation. Monster CRs are balanced such that raw damage output is matched to PCs of a given level. In other words, if you double the damage your zombies are doing, there's a good chance you could one-shot a PC, or two, or the whole party. If you halve the damage the zombies can do, your players are likely to breeze through the encounter. It is safer simply to increase a foe's defenses and thereby give it more opportunities to hit.
If you are feeling a little creative, you can even add some flavor to represent the adjustments you've made. Those zombies might be wearing scraps of armor (reflecting a better AC), or might be especially old, decomposed, and unsteady (reflecting worse saves and/or HP).