#18 - How to design better randomness in video games
Explores how game developers can refine randomness to create more balanced, engaging, and satisfying experiences.
In common usage, randomness is the apparent or actual lack of definite pattern or predictability in information.
As a huge rogue like’s and mmorpg’s genre fan, my experience in video game is full of randomness.
When I launch a game of Balatro, I don’t know which joker I’ll encounter this time. If I play Slay the Spire, I can’t predict how my build will evolve. And what did my next Minecraft world will look like? I have no idea neither.
That’s a big part of why I come back into these game (and why players on Steam love them), I'm attracted by the promise of infinite replayability with many different ways of playing the same game - which is only possible due to randomness.
Is there a magic random() function?
Does it mean game developers use a magic “random()” function in their code which make instantly item rarity drop or shuffling card looks cool and fun?
Short answer: Nope.
Long answer: There are tons of way of doing random and we’ll explore some in this article. If you loved game like Balatro, Slay the Spire, Minecraft, Dead Cells and want to learn more about how they make random fun, you’re at the right place.
In this article, we'll explore different ways of improving a game's randomness so… grab a drink, and enjoy!
Why does true random feel’s wrong?
In most video games and board games, there is always an element of randomness, and you’ve probably encountered it before. However, randomness isn’t always fun, and game designers often avoid using it without adjustments.
A roguelike is a game genre with procedurally generated levels and permanent death where each playthrough is unique.
Far be it from me to criticize randomness—I’m a big fan of rogue-like games, so that would be quite ironic. I don’t think it is inherently bad, but there are times when it can be wrong. Let me give you three examples.
Random generate frustration
Here’s a real story every MMORPG player’s will understand.
The quest giver ask for 10 magic stone.
The drop rate for those stone is 50%.
You killed 100 monsters and still have not finished the quest.
Can be frustrating isn’t it? Yep. But it is what it is.
When you search the body of a freshly killed monster, the computer generates a number associated with the loot table and delivers it to you, without any additional logic.
If you are lucky enough, every monster will drop the thing you’re looking at. If not, you’ll spend hours searching thoses. The exact same way you can throw 100 times a dice and never land a 6.

Random is imprevisible
In the game I’m working on, Another Door, players face a random sequence of 2 to 7 monsters. During our playtests, we quickly experienced the same monster being played several times in a row, which was not the experience we wanted.
This immediately gives the impression that the game lacks content.
We could always increase the number of different monsters: 1, 10, 100, 1000... But there's will always be a chance, however small, that it could happen. It is completely unpredictable, and as a game designer, that's not what I'm looking for.
To be 100% precise, it’s predictable because computer use pseudo random to generate numbers, as well explained by this reddit comment.
Computers use clever math tricks to make numbers that look random. They begin with a starting point called a seed and then follow a set of rules to create a sequence of numbers. The catch is that if you use the same starting point (seed), you'll get the exact same sequence. To make things less predictable, they often use things like the current time or user actions to set the initial seed. This makes the numbers seem random enough for things like games or security.
Random can’t give feedback
Players need feedback to learn and improve, as we need it in the real world:
If I fall, it hurts.
If I hit the ball harder, it goes further.
If I keep writing newsletter, subscriber growth.
And so on…
If the outcome of their actions is too random, it becomes harder to discern which strategies are effective. And when we play a game (except in the case of Russian roulette) we expect to learn how to become stronger.
That said, it’s a bit funny because my game is based 50% on luck and 50% on bluffing. But as mentioned above, luck (or randomness) isn’t inherently bad. There are great types of games that don’t rely on the elements I’ll list below.
If you’ve heard of the game Buckshot Roulette (which has an incredible art style that I would love to explore in another article), you know its core mechanics are based on randomness. The game designer simply decided to add elements to manipulate, influence, or adjust the outcome, to trick the randomness rather than fundamentally alter how it works.
After all, being lucky is fun.
What can be done to improve randomness in game?
Here we are, now that we seen few element that can make random wrong, because random in game don’t have to be that random, let’s deep dive in techniques to not let bad luck or random generation ruin your game.
At the beginning: Scripted randomness
Definition: Random events that are pre-designed and follow a specific set of rules or conditions. These are predictable but can still produce variation in outcomes.
This. Almost every technique I’ll describe is an extension of this definition. There is always some randomness, graciously generated by your computer, but it is subject to rules, rules that we, as game designers, decide to implement based on the context.
The Marble Bag
Definition: A randomness control technique where drawn outcomes are not replaced until all possibilities have been exhausted. This ensures every option appears over time while maintaining variation in order.
Imagine a bag filled with three marbles: one blue, one green, and one red. If you draw a marble without looking, you have a 1 in 3 chance of getting a blue, green, or red marble. So far, nothing new.
When we use randomness without limitations or rules, it’s as if we put the marble we just picked back into the bag before each new draw. The odds never change.
This is where it gets interesting. We can choose a different approach and introduce a new rule to our game: once a marble has been drawn, it doesn’t return to the bag until all marbles have been picked.
This ensures that after a certain number of draws (three in our case), we will have obtained all possible outcomes: one blue, one green, and one red.
The final results will always be the same, but the order in which they appear will vary.
I’ve discovered it on this video, it’s 7min long and worth the watch.
Fixed Limit or Streak Breakers
Definition: If the same outcome occurs too often in a row, we can force a different outcome to prevent streaks of bad or good luck. This fixed limite can be a timer, a number or even a random number (inception here we go).
In a game with a critical hit chance, there is always a possibility that a critical hit never occurs during a fight, even after 100, 1,000, or even 10,000 hits. To prevent this, we can set a limit so that once the threshold is reached, the next hit is guaranteed to be a critical hit.
This is a good way to prevent bad luck streaks, but it should be used with caution.
I intentionally chose the example of critical hit chance because if players realize there is a limit on randomness (and they will), they may exploit it to their advantage, for example, by deliberately performing non-critical attacks until they reach the streak break, then boosting their character’s abilities at that precise moment, knowing the critical hit is guaranteed.
My advice would be to use this system for less "critical" mechanics than a critical hit. For example, in a loot table for common items or determining the appearance of a merchant during a run.
Hidden Rerolls
Definition: Random outcomes that are reattempted behind the scenes without the player’s knowledge, often to improve or adjust results without directly revealing the process.
Because humans struggle to understand probabilities, like our player who insists that our mechanic with a 90% success rate is broken because it didn’t fail ten times in a row, you can just… well, lie to them.
This is something I came across in the excellent video by Game Maker’s Toolkit on “The Two Types of Random in Game Design”.
Does your game feature a high probability, like a 97% chance of doing X? Just roll the random twice, take the better result, and voilà. You’re now a liar, but your players will feel better.
Design tips
One key point from the video is that players tend to grasp their chances better when dealing with physical objects, something they can hold in their hands. It’s much easier to visualize rolling a 20-sided dice and seeing the result than interpreting a "23% chance" written on a card. (Tip from Zach Gage, game designer of Tharsis)
Which means that better randomness doesn’t exist only in the developer’s code, but also in the visual representation in the game. If your players struggle to understand the odds, give them a physical representation of chance: roll a dice, draw cards, spin a wheel of fortune, flip a coin…
Adaptive Randomness or Bias Towards Progression
Definition: Randomness that adjusts based on the player's actions or game conditions to create a dynamic experience.
I've experienced this in roguelikes. Once I start using a specific item, the game adapts and offers me more upgrades related to that item.
I'm not entirely sure about this one and couldn't find confirmation online, but I suspect it happens in Balatro. When I play a specific hand type, like a pair, I seem to have a higher chance of finding upgrades for pairs in the shop.
This is not a 100% chance, but I feel really lucky to get something useful when I open the shop. On the other hand, never getting the upgrade I’m looking for is disappointing.
Weighted Random
A form of pseudo-randomness where certain outcomes are more likely than others due to weighted probabilities.
Weighted random is a simple way to add probabilities to your randomness. As I mentioned earlier in Another Door, players face a series of monsters, and I needed some to appear less frequently than others to avoid them all having the same appearance rate.
The weighted random technique makes this possible.
With this approach, each monster has its own probability of appearing. The difference from the Marble Bag technique is that, even after hundreds of draws, players wouldn’t necessarily have seen all the monsters.
If you're using Game Maker, I followed this tutorial to create a weighted random function: https://yal.cc/gamemaker-weighted-choose/
Controlled Chaos
Controlled Chaos is a system where randomness is used, but within set limits or rules, creating unpredictable yet manageable outcomes.
Let me quote the Lead Designer of Dead Cells, an amazing rogue-like in pixel art made in France.
Not satisfied with either full handcrafting or full procedural generation, we could feel that there was a way to find a middle ground that would work.
Here, we’d like to thank the guys behind Spelunky, who came up with some interesting solutions to the same problem. You can find a brief explanation of how that works here, if you’re interested.
But to sum it up, they used a hybrid approach between procedural generation and handmade levels, giving them that consistent feeling while maintaining a lot of diversity.
This technique allowed the small team behind Dead Cells to create a replayable game without letting full procedural generation take over the game design direction.
Procedural Generation
Definition: Content creation based on algorithms and rules that often incorporate randomness. While it uses random elements, the results are still structured or guided by a procedural system. (e.g., levels, terrain, enemies).
I agree, it’s really close to the definition of Scripted Randomness. The main difference is that the term procedural generation is more often used to describe the creation of dynamic content, such as visual content like a level, a monster, or even a planet (hello No Man’s Sky).
If you want to visualize what "random" vs. "procedural generation" looks like, here’s a little comparison of two Minecraft world generations:
As you can see, the first one looks totally random, with no rules, no logic, just pure chaos. While the second follows some rules in its creation, decided by the game designer.
If you want to work with procedural generation, and I encourage you to do so because it’s an amazing way of creating worlds, you can take a look at Perlin Noise.
As you can see, I've generated a few numbers using a "random" algorithm and one with Perlin Noise. What’s immediately noticeable is that the numbers generated with Perlin Noise appear visually ordered. This is exactly what we want: a “random” sequence of numbers that follows a pattern.
Perlin Noise is a very powerful tool, used in many different ways in video games, such as:
World/level generation
Texture creation: water, wood, clouds…
Making enemy movement
…
I won’t go deeper into a tutorial about Perlin Noise, as there’s tons of content on the internet about it. As usual, I’m giving you the hints so you can do your own research!
Kill game randomness
One thing I hadn’t considered before writing this article is that sometimes it’s enjoyable for players to have the option to completely remove randomness.
Let’s take an example from a game I particularly love: Risk of Rain 2, a roguelike third-person shooter where players battle waves of enemies, collect powerful items, and try to survive on an alien planet.
In this game, randomness plays a major role, from the way enemies appear (their type, location, and timing) to the items players can find to upgrade their arsenal.
However, the developers offer an alternative game mode that allows players to choose their items, effectively eliminating this aspect of randomness.
I didn’t expect to enjoy this mode so much. It allowed me to test very specific builds, something quite difficult in the default mode. I also had the chance to discover all the game’s items, even the rarer ones.
Sometimes, improving randomness in your game means giving players the option to kill it.
Before I finish, let’s talk about “seed”
If you double check the screen of the Dead Cells level design, you can see this text on the top “seed=550129“.
A seed is a starting value that is used to initialize a random number generator (RNG).
The seed determines the sequence of random numbers that the game will generate. If the same seed is used, the game will produce the same "random" results every time, which ensures repeatability. Seeds are often used in procedural generation so that players can share or revisit specific game experiences by using the same seed.
For example, in Minecraft, the world generation is based on a seed: if two players enter the same seed, they will get identical worlds.
The seed is useful as a developer when you need to replay a defined session to find a bug. It’s also useful for your players to share their experience. Allowing them to share this small code is a great way to make your “random” gameplay replayable.
Conclusion
This was a really dense article, and I still have a lot to say about randomness. As always, I’m giving you a hint to encourage your own research. Randomness is a powerful tool, and there are so many ways we can refine it to improve our games.
If you need a more specific tutorial on coding or designing something, let’s discuss it in the comments. I always appreciate your feedback!
Links worth visiting
Random Tidbits: Use Chance to Enhance Fun! techniques for generating random numbers which are optimized for player-psychology and design intentionality
How a Smash Bros. Fighter is Designed by Game Maker's Toolkit
Celeste Teams' Next Game, Earthblade, Canceled - Fans of the 2D platformer Celeste, you'll be sad to hear that the developers' next game has been canceled
Social Media for Indie Game Devs: How to Create Content That Attracts Players
Watch This if You Haven't Started Marketing Your Game
200+ tutorials & educational resources for gamedevs & machine learning enthusiasts
l1-path-finder is a fast path planner for grids
10k wishlists at launch, ~2% conversion rate after one week, did we do something wrong?
How To Market Your Indie Games For (Almost) Free