What You Will Be Able to Do
By the end of this lesson, you should be able to:
- Map a random generator's range into equal blocks for
choices - Detect the bias when the count doesn't divide the range evenly
- Fix it with a divisible range or rejection sampling, verifying each is
From Dice to a 1-to-100 Generator
A die has 6 equally likely faces. A generator gives equally likely integers — say 1 to 100.
Same idea: map them into equal blocks.
For k Choices, Generate 1 to k
The cleanest approach: generate an integer from 1 to k directly.
Each value is equally likely, so each choice gets
Map a Larger Range Into Equal Blocks
For 2 choices on a 1-100 generator: 1-50 and 51-100, each
A Fair Generator, an Unfair Mapping
The generator can be perfectly fair while the mapping is biased.
Two separate questions: is the generator fair? Are the blocks equal?
Predict: Is This Split Fair?
A 1-100 generator, 3 choices, split 1-33 / 34-66 / 67-100.
Is each choice equally likely? Commit before advancing.
Count the Blocks: 33 / 33 / 34
The third choice gets
Why: 100 Is Not Divisible by 3
That leftover 1 has to go somewhere — and wherever it goes gets favored.
Fix 1: Use a Divisible Range
Generate 1 to 99 instead of 1 to 100.
Now split into 1-33 / 34-66 / 67-99 — each exactly
Fix 2: Reject and Redraw (Rejection Sampling)
Keep 1-100, but reject 100 and redraw. Use only 1-99, split evenly.
Generalize: Reject the Top (n mod k)
To choose among k options with n equally likely outcomes:
Reject the top
Verify Each Choice Is Exactly 1/k
A procedure is fair only if you can show each choice's probability is
After any fix, count the block and confirm the fraction.
Resolve the Teaser: 5 With a Die
Five choices, a 6-sided die.
Use faces 1-5 for the five choices; re-roll on 6.
Your Turn: Find and Fix the Bias
A 1-1000 generator picks among 7 prizes, split into blocks of about 143.
Is it fair? If not, fix it and verify each is
What You Learned This Lesson
✓ Map a range into equal blocks — generate 1 to k when you can
✓ A leftover remainder biases one choice
✓ Reject the leftovers, redraw, and verify
Where Fair Randomness Goes Next
Fair random assignment underlies randomized sampling and experiments (HSS.IC).
And rejection sampling is how computers generate unbiased random integers.