Script the Scenario, Not the Outcome
Session to session, adventuring parties will encounter scenarios the Dungeon Master (DM) has prepared for them. These scenarios give the session content for players to engage with. As DM, you’ll often find yourself coming up with your own scenarios for the party to overcome even if you’re running from a module or campaign book. Many of these scenarios are prepared in advance, or at least conceptualized, before the session they’re featured in. I liken these to scripted events in video games. In Skyrim, quite early into the game, the protagonist is (seemingly randomly) approached by an Old Orc asking for an honorable fight to the death. The two available options are to engage him in a fight and grant his wish, thereby killing him, or to decline and leave him to sit where you found him until the end of time (or you come back and kill him later). Being an iconic RPG, the choice is yours, so long as it fits into one of those two scripted options. Moreover, while the Old Orc approaching you has a degree of randomness as to when and where it happens, it will inevitably happen in your playthrough should you explore enough of Skyrim.
But, tabletop games aren’t video games, nor should they be treated like one.