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 - Judge a mapping by each choice's probability, and fix an unfair one
- Handle a remainder 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.
Recall: Asking for a Random Integer
- A random-integer tool takes a low and a high end, both included
- 1 to 100 gives 100 possible integers; 1 to 6 gives 6
- We assume an ideal generator: every integer in the range is equally likely
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
Two Separate Questions to Check
- Is the generator fair? (We assume yes.)
- Are the blocks you mapped it into equal in size?
A trial run with roughly equal tallies does not prove the blocks are equal.
A Fair Generator, an Unfair Mapping
Two choices on a 1-100 generator, split 1-49 and 50-100.
Choice 1 gets
Your Turn: Fair Blocks for Four
A 1-100 generator must choose among 4 people.
Design equal blocks and state each person's probability.
Is there a simpler way if you can change the range?
Quick Check: Which Mappings Are Fair?
All use a 1-100 generator:
- 2 choices: 1-50 / 51-100
- 5 choices: 1-20 / 21-40 / 41-60 / 61-80 / 81-100
- 4 choices: 1-24 / 25-50 / 51-75 / 76-100
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.
Recall: Division With a Remainder
Three equal groups of 33 use 99 integers. The remainder is the 1 left over.
Count the Blocks: 33 / 33 / 34
The leftover landed in block 3: it gets
Fix 1: Set the Generator to 1-99
If you can choose the range, generate 1 to 99.
Split 1-33 / 34-66 / 67-99: each exactly
Fix 2: Reject and Redraw (Rejection Sampling)
Range fixed at 1-100? Reject 100 and redraw. Act only on 1-99, split evenly.
One Attempt vs. Eventual Selection
- Each attempt: each block
; rejection rejections in a row: , which shrinks toward 0, so a choice is eventually made- Eventually: each block gets
Why Not Just Keep the Leftover?
Give 100 to any choice and that choice gets
Rejecting wastes an occasional draw but keeps every choice at exactly
Generalize: Reject the Top (n mod k)
For n equally likely outcomes, k choices,
- Reject the top
outcomes (remainder of ; ) - Split the rest into
equal blocks - Redraw independently (a fresh draw, unaffected by earlier ones) until accepted
- Verify each choice is
Resolve the Teaser: 5 With a Die
Five people, a six-sided die:
Faces 1-5: each
Quick Check: A Die for Four People
Four people share one six-sided die.
Which faces do you reject? What is each person's chance per roll, and eventually?
Your Turn: Find and Fix the Bias
A 1-1000 generator picks among 7 prizes: six blocks of 143 and one of 142.
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.