Randomness is a topic that comes up quite often in game design and development. It is also a difficult topic to comprehend for some. Without it you may end up with a very linear game that offers little replay value.
When it comes to computers there is no such thing as "true random". Technically any computer-based random number generator (RNG) is built around some type of pseudorandom number generator (pRNG). While the mechanics of how computers generate random numbers isn't the subject of this post, Wikipedia has some great information on that topic. In game development it is pretty much understood that the pRNG system is more than good enough to serve our needs – otherwise we would need someone in the background rolling a lot of dice to get a true RNG for every action in a game.
Games generally use random numbers for things such as character stats, attack damages, loot rewards, generating maps, and the like. Most of these examples fall within specified ranges to offer a balanced, or at least structured, design.
By assigning random stats at character creation you can force a player to adapt to their stats or to find a different play style. This is common in class-based characters such as you would see in the pen and paper game Dungeons & Dragons. If you choose a melee type class but your strength is quite low, your attacks will be underpowered and this can lead to more difficult gameplay in the beginning. Whereas if your strength is much higher than normal you will likely start off at an advantage.
Combat in turn based games requires knowing which character attacks next. Using a stat such as "SPEED" is great for this. If you control a team of characters and you can manipulate your speed stat then you can pre-determine which order your team will go in (barring any outside influence). As far as the enemies go, randomizing their speed stat will affect the full order of turns.
Probably the most controversial use of RNGs in games though is for rewarding loot. This is especially true in games that have tiered classifications of items such as "World of Warcraft": (e.g., "JUNK", "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY"). What this means is that if you defeat an enemy, there may be two (or more) pools of prizes from which your reward may be pulled. Most games that use such a ranked system (e.g., World of Warcraft, Borderlands, Monster Hunter, Overwatch) also utilize prize pools.
In terms of game design, you will assign each pool a chance rating. It wouldn't make sense for every enemy kill to have the same chance of dropping a "Common Wand" and the "Legendary Wand of Flamestrike". Otherwise your players will end up with all of the unique items and gear before they even have a chance to really play the game. Don't do that. Unless that's the type of game you're trying to make.
Balance is an integral part of any game. Use your RNGs wisely. You can think of your prize pools this way:
- JUNK & COMMON – 90%
- UNCOMMON – 6.0%
- RARE – 3.5%
- EPIC – 0.4%
- LEGENDARY – 0.1%
There is a 90% chance of pulling a reward from the first pool. This means that every time it rolls for your prize, there is a 90 out of 100 chance of coming from that pool. It also means there is a 1 out of 1000 chance of a prize from the LEGENDARY pool. What this doesn't mean is that if you roll 1000 times you will be guaranteed an item from the LEGENDARY pool. If you flip a coin 100 times, it is always a 50% probability of being heads. You would expect to get roughly 50 heads and 50 tails, but you could still end up with tails 99 times. That's called random chance and there are plenty of articles and videos describing the difference between chance and probability.
Hopefully that gives you a little more insight into how "randomness" is used in game design.