Sub topic 5
Input randomness and output randomness
This chapter assumes you can compute a simple expected value and variance (covered earlier in this tutorial), you know basic dice odds, and you can read short Python programs. It separates two places where chance can enter a game: before the player decides, or after.
Two places chance can live
Every random element in a game sits at one of two points in the decision loop.
- Input randomness happens before the player chooses. The game generates a situation, and the player responds to it. Examples: a shuffled hand of cards, a procedurally generated map, a random set of enemies in a room.
- Output randomness happens after the player chooses. The player commits to an action, and then chance decides the result. Examples: a to-hit roll, a critical-hit chance, a loot drop after a fight.
The same unit of chance can feel very different depending on where it sits. Input randomness asks, "Given what I was dealt, what do I do?" Output randomness asks, "I have done this. Did it work?"
How each type affects agency
Agency is the degree to which a player's choices determine what happens to them. Both types of randomness reduce it, but in different ways.
Input randomness
With input randomness, the player sees the random result and then decides. Skill shows up as adapting well to what was generated. Because the player knows the situation, they can reason about risk with full information about the current state.
- Strengths: it creates variety between sessions, and it rewards players who read situations well. A bad draw can be a puzzle rather than a punishment.
- Weaknesses: if the generated situation is unwinnable or trivially easy, no choice can fix it. The player feels the game was decided before they touched it.
Output randomness
With output randomness, the player decides first, then accepts the roll. The decision is about which gamble to take, because the outcome is uncertain at the moment of choice.
- Strengths: it creates tension and drama, since the player is watching a result they cannot influence. It also lets weaker players win sometimes, which keeps casual games lively.
- Weaknesses: a good plan can be wrecked by a bad roll, and the player may feel their skill did not matter. This is the "I did everything right and lost" feeling.
| Property | Input randomness | Output randomness |
|---|---|---|
| When chance resolves | Before the player decides | After the player decides |
| What the player knows when choosing | The random result | Only the probabilities |
| Where skill shows | Adapting to the situation | Choosing which gamble to take |
| Typical frustration | "The game dealt me something unfair." | "My good choice failed." |
| Typical pleasure | Solving a fresh puzzle | Suspense and big swings |
The same chance, placed two ways
Consider a designer who wants an attack to deal 10 damage half the time. There are two ways to do this.
- Output version. The player chooses to attack, then flips a coin. Heads deals 10, tails deals 0.
- Input version. At the start of the turn, the game flips the coin and shows the player. If heads, the attack is "charged" and will deal 10. If tails, it is "weak" and deals 0. The player then decides whether to attack or do something else.
Both have an expected damage of 5 per attack. The difference is in what the player can do about it. In the input version, a weak attack can be skipped in favor of a better action, so the player's skill converts chance into advantage.
The following code compares the two designs. In the output version, the player always attacks. In the input version, the player attacks only when the attack is charged and otherwise takes a guaranteed 3 points of damage with a safe alternative action.
import random
def output_version(rng):
# Player commits to attacking, then the coin decides.
return 10 if rng.random() < 0.5 else 0
def input_version(rng):
# The coin is revealed first. The player attacks only if it is charged.
charged = rng.random() < 0.5
if charged:
return 10
return 3 # safe fallback action
def average(fn, turns=100_000, seed=7):
rng = random.Random(seed)
return sum(fn(rng) for _ in range(turns)) / turns
print("output:", round(average(output_version), 2)) # about 5.0
print("input: ", round(average(input_version), 2)) # about 6.5The input version averages about 6.5 because the player used information to avoid a wasted turn. Same coin, same probability, but the placement of the coin gave the player a way to act on it. This is why many designers describe input randomness as giving decisions and output randomness as testing them.
Variance and the two types
Recall that variance measures spread. Output randomness tends to produce more variance in results for a given decision, because the player cannot respond to the roll. Input randomness can produce just as much variance in situations, but the player's response often shrinks the variance in outcomes.
You can see this with a short calculation. The output version above has outcomes 10 and 0 with equal probability, so its variance is 25. The input version has outcomes 10 and 3 with equal probability, so its mean is 6.5 and its variance is 0.5 × 3.5² + 0.5 × 3.5² = 12.25.
def expected_value(outcomes):
return sum(p * v for p, v in outcomes)
def variance(outcomes):
mean = expected_value(outcomes)
return sum(p * (v - mean) ** 2 for p, v in outcomes)
output_outcomes = [(0.5, 10), (0.5, 0)]
input_outcomes = [(0.5, 10), (0.5, 3)]
print(variance(output_outcomes)) # 25.0
print(variance(input_outcomes)) # 12.25The input version has both a higher average and a lower variance. This is not always the case, but it shows why input randomness is often the safer choice when you want consistent play.
Mixing both types
Most real games use both, and the mix defines their character.
- Poker has input randomness (the cards you are dealt) and strong decision-making around them. There is also output randomness at the end, when the final cards are revealed.
- Roguelikes often generate a level (input) and then resolve combat with hit rolls (output).
- Card-battlers shuffle a deck (input to each draw) and then play cards with deterministic effects, so most of the chance is input.
- Classic tabletop role-playing games lean on output randomness, because the player declares an action and then rolls to see if it works.
A useful design question is: "At what moment does the player learn the result of chance, and what can they still do about it?" If the answer is "nothing," the randomness is probably pure output. If the answer is "plenty," it is likely input.
Common errors
- Treating them as interchangeable. Moving a roll from after the choice to before it changes the game. It gives the player more information and more options, so you may need to retune the payoffs.
- Stacking output randomness. A hit roll, then a critical roll, then a damage roll multiplies uncertainty. Each layer is a separate chance for a good plan to fail, and total variance grows quickly.
- Using input randomness without recovery options. If a bad draw leaves the player with no useful actions, the game has removed agency rather than adding variety. Later chapters on mitigation tools and failure recovery cover this.
- Ignoring perceived fairness. Players tolerate output randomness better when the odds are shown and the stakes are low. They tolerate input randomness better when they have a way to respond.
Summary of the working model
- Locate each random element: before or after the player's choice.
- Ask what the player knows when they choose and what they can still change afterward.
- Estimate expected value and variance for the decision with and without the randomness.
- Check whether the placement fits the experience you want: puzzle-like adaptation or suspenseful gambling.
Exercise
A strategy game currently lets the player attack an enemy, then rolls a die: on 4–6 the attack hits for 8 damage, on 1–3 it misses for 0. A designer proposes revealing the die roll at the start of each turn, before the player picks an action, with a safe fallback action that deals 2 damage. Assuming the player attacks only on a hit roll and otherwise uses the fallback, what is the expected damage and variance of each version, and which type of randomness does each use?
Show answer
Current version (output randomness): outcomes are 8 with probability 0.5 and 0 with probability 0.5. Expected damage is 4. Variance is 0.5 × (8 − 4)² + 0.5 × (0 − 4)² = 16. Proposed version (input randomness): outcomes are 8 with probability 0.5 and 2 with probability 0.5. Expected damage is 5. Variance is 0.5 × (8 − 5)² + 0.5 × (2 − 5)² = 9. The proposed version has a higher average and lower variance because the player sees the roll before choosing and can avoid a wasted attack.
Exercise
Name one game mechanic you know that uses input randomness and one that uses output randomness. For each, state what the player knows at the moment they choose and one way the designer could shift the mechanic to the other type.
Show answer
Answers vary. A valid example: a shuffled starting hand in a card game is input randomness, because the player sees the hand before acting. It could shift toward output by hiding the hand and making the player choose a card blind. A to-hit roll in a tabletop role-playing game is output randomness, because the player declares the attack and then rolls. It could shift toward input by rolling at the start of the turn and showing the result before the player picks an action.