Most games include randomness in them in order to improve replayability and to make things a little more interesting. If you can't always predict what will happen then the game tends to be more fun for the player. This, however, can be undermined by improper use of a random number generator. As such, pure randomness isn't always fun. It's better to make things partially random so that they vary rather than appearing purely chaotic.
Good uses for the Random Number GeneratorEdit
- Level layouts in Roguelikes (i.e. choosing between different rooms and how to connect them)
- Random drops based on the player's level and the mob defeated
- Procedural Generation of a game world
Example 1: Minecraft Edit
Minecraft! Everyone's favorite (or at least, the most popular) sandbox game! Minecraft uses the RNG very well. Each of its worlds are "procedurally generated". That is to say, it utilizes an RNG and a seed in order to ensure that the likelihood of seeing the same landscape in each world is as minimal as possible. There are still patterns and algorithms that Minecraft utilizes to generate the landscape, but these patterns are sufficiently varied by proper use of the Random Number Generator.
Example 2: Hearthstone Edit
Many of the hearthstone cards have random elements and it would be a lie to say they all used RNG correctly. However, a few cards add the perfect variability while not making the player feel like they have no agency. If we consider the card Sylvanas Windrunner we can see there is a random element in the deathrattle (triggers after minion dies). Although this effect is extremely powerful and completely out the players hands, the opponent rarely feels 'cheated' by sylvanas as they always get the choice of how to respond to her. After my opponent plays sylvanas should i trade away in all my minions in possibly a sub optimal way so that there is nothing left for sylvanas to steal when she dies? do i spend a large amount of mana to use one of my powerful removal spells? or most excitingly, do i load up my board with low cost weak minions before i kill her and hope she doesn't steal one of my more powerful ones? The randomness here CREATES choice rather than destroying it which is the key to adding randomness to a game without it making the game not fun.
XCOM: Enemy Within
In XCOM: Enemy Unknown or Enemy Within, it smartly uses RNG (or Random Number Generators) to determine if the squad that the player controls will hit their target. There is usually a percentage (like 80%) to see how likely it is that they'll hit their target. This increases the tension and makes the gameplay more interesting.