Below is analysis of loops and randomness done as part of Arcada's game design course done with Anton Lindgren, Hijran Kiroran and Pauli Taimi.
Game of choice
A great game, that will be played for a long time and be remembered in history has a great core gameplay loop, which will makes repeating the same actions over and over again engaging no matter how much time passes. Or at least long enough for the player to complete the game at least once. A prime example of such a game is Prince of Persia: The Sands of Time.
Loops
The primary core loop is not the time loop, as one may think, but traversal, that is getting from point A to point B. It is arguably the thing you do the most in the game, and Prince has more than 700 animations for just that, which was insane at the time. There is also a secondary loop, that of combat, which happens less often and had a few times, when it was mostly optional. In addition, there is a tertiary loop of puzzles, some of which not only progress the story, but also allow upgrades to the character, whether mandatory ones or optional ones though secret rooms.
These loops sound pretty basic nowadays, but as this retrospective points out, the amount of time you spend in each one and how satisfying finishing them feels, is what makes the game great. You do not get tired of any of them, because each provides different types of challenges, and any of them feels "in the right place".
What makes those extra interesting, though, is another loop, which is a loop of failure (not unlike modern souls-like games, in fact). The game even has moments where you need to fail, so that it can teach you special skills, that are granted to Prince by the titular Sands of Time, with the very first one being time rewind. These skills are also a positive feedback loop: there are tools which allow you to rewind the last 10 seconds of your gameplay, slow down everything around you or freeze enemies. There is also a combination of the latter two.
Say, you got hit by an enemy and lost the remainder of your health. In other games, that would spell "Game Over" for you, but in Sands of Time you can recover and, perhaps, move away before getting hit again. Slowing down enemies or even freezing them for awhile can also make the combat somewhat easier, especially when there are multiple enemies, by giving you a little bit more breathing room for dodging or blocking.
Of course, if left unchecked, these skills become too powerful and can remove the challenge from combat segments and even some traversal ones, making them feel boring. To prevent that, the game has a negative feedback loop of… Limiting the number of times you can use respective skills. Yes, the number of "tanks" can be increased by finding secret rooms and absorbing the literal sands of time, but even then, they will be limited, and The Power of Haste will eat all of them at once. Thus, you need to apply some strategic thinking on when to use the skills, because the main way of replenishing the "tanks" is successfully killing enemies.
Even more loops
If the game was released nowadays, it probably would have some more loops, probably as RPG elements. Original Sands of Time does allow you to increase your health and sands storage, as well as replaces swords, but some modern studious would add more ways to increase the character's stats. Probably the simplest one would be to increase the rewind time from 10 seconds up to, let's say 20, if you find a secret room with some fancy scabbard for the Sand Dagger, which is imbued by the Sands and thus increases the dagger's power. That would give you a potential to rewind a whole fight and redo it without getting hit at all, after memorizing the tactics of the enemies.
Adding such positive loop alone can make things a bit too simple, though. And while the need to find the scabbard is a challenge by itself, we can add a negative loop of eating away at Prince's health, when using the rewind past the original 10 seconds mark. That is if we stay in rewind for more than 10 seconds at a time, the HP starts reducing gradually. Probably, not by much, but still. This can even be explained through the narrative, as "it is taxing for the body" or "it is difficult to keep appropriate level of focus for that long".
Alternative or additional negative loop could be requiring more enemies to fill every consecutive sand tank for combat skills. Original game requires killing 16 enemies to fill one of them completely, regardless of how many are already full. We could adjust the logic, so that 1st tank would require 10 enemies, the 2nd one – 15 enemies, 3rd one – 20 enemies and so on. Of course, the exact number of enemies would require proper testing so that the game would not become too difficult.
Random enemies
This would not be enough for modern studios, though. They would want to implement some randomness, because randomness can be fun, as some rogue-like fans can attest to. Original game does have something that may feel random during the combat, that is enemy behavior, but that one is not random or, at least, not random enough. Example of input randomness (something that happens before a player's decision) would be number and type of enemies in each encounter, while example of output randomness (something that happens after a player's decision) would be introduction of critical hit chance and damage to the combat system.
These two examples of randomness could provide an increased challenge during combat. Randomization of enemy numbers and types will make every encounter within multiple replays unique, thus you won't be able to prepare in any way. And critical chance and damage can make you think a bit more strategically and, possibly, be a bit more reactive, because you will never know for sure if a particular strike will be a finishing one. But there is a flip side.
As mentioned, what made Sands of Time great was the time you spent in each gameplay loop or "pacing". One of the things, that helped achieve that was manual tailoring of each encounter. That helped introduce new mechanics through fights, when it was required, and it helped with gradual increase of the challenge, which reflected the accumulated skill of a player getting through the game.
The first fight will be simple. It will be a tutorial one, letting you get a handle of the basic moves (attack, block, dodge), the timings. You will finish the fight and think: "Ok, I understand how it works. I can use this. Let's try something more difficult next time". If add randomness or chance to this, it can happen that 1st fight will be excruciatingly difficult, and perhaps it will be so multiple times in a row, even with fresh restarts. Then one would think: "This is too difficult. It's unplayable. I want a refund." In addition, it's possible that some enemies will need special moves to defeat them, and those are simply not yet unlocked, which will, indeed, make the segment unbeatable. Or it can happen that the last portion of the game will become extremely easy and thus potentially boring.
So, if any of these randomness types were to be implemented, you would need to think of a way to disable it for certain fights. Or better yet, devise a logic for "difficulty pools", from which you will select enemies based on the player progression in the game and maybe some other parameters, as well, like selected combat difficulty (like Devil May Cry games). And with critical chance you can increase the chance the lower the enemy's health is, which will also provide a bit more satisfaction in tougher fights.
Weapon break
Another possible randomness, which may be both input and output at the same time is breaking of the secondary weapon, similar to what Prince of Persia: Warrior Within had. You can randomize durability of a weapon when it is picked up and/or you can randomize the damage to the weapon on every hit (or maybe on every successful kill). You still need to be careful with implementing it, probably use tight ranges so that weapons would not break to quickly, and you would need to ensure, that it is relatively easy to find a new one.
All in all, it is important to have balance. Original Sands of Time was not that complex by modern standards, but it still was providing high level of satisfaction throughout the whole gameplay, because everything was "on point" and there was a certain "flow" of things. Sadly, quite a few games nowadays lack that and have no idea what good pacing means. Does not necessarily make them bad games, but does not make them great ones, either.