C46 · Topic 3.15 · 40 minutes · AAP-3.E
Map random choices without introducing bias
By the end you can:
- Select valid random list positions.
- Explain how duplicate labels change category probabilities.
- Design sampling without replacement and handle an empty list.
Before this lesson: topics 3.3, 3.6, 3.8.
- Random integer
- An integer selected from a stated range by a random process.
- Expected frequency
- The long-run average count predicted by a probability model, not a guarantee for a particular run.
Understand
One equally likely integer can index a list because AP list positions 1…LENGTH(list) are valid. To select a random member from a nonempty list, use list[RANDOM(1,LENGTH(list))]. RANDOM(0,LENGTH(list)) risks the invalid position 0.
Fair integers do not ensure fair categories. If the same name appears twice, that name is more likely to be selected. To sample without replacement, remove each selected entry before the next draw; repeated independent draws can repeat an entry.
Worked example
tickets ← ["A", "A", "B", "C"]. Draw one uniformly random valid list position.
- A has two of four positions, so probability 1/2.
- B andC each have probability 1/4.
- Removing the chosen ticket prevents that ticket from reappearing, but another A ticket can still be selected.
Explore each concept
Choose a concept, change its inputs and follow the explanation. Each example models the stated rule or scenario; completing it is practice rather than evidence of mastery.
- Inclusive integer bounds
- Exact event probability
- Expected count is not a guarantee
Change it · step through · explain
Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.
Ready · Make a prediction
- Lower bound (0–10)2Waiting
- Upper bound (0–10)6Waiting
- Success at or below (0–10)3Waiting
Ready to explore: Inclusive random ranges and expected outcomes
Why: Change an input, predict the first effect, then advance one step.
Try this: Change one input or choose another listed case. Predict the effect, reset and compare the states and governing rule.
Step through and experiment
Change it · step through · explain
Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.
Ready · Make a prediction
- Input 13Waiting
Ready to experiment
Why: Predict the first change, then advance one step.
Try this: Try thresholds 0 and 10. The supplied stream is deterministic, not randomly regenerated.
Check a misconception
Claim: Uniform positions make every distinct label equally likely.
A repeated label owns more positions and therefore more of the probability.
Guided practice
Change the ticket list to make B twice as likely as A or C, and state each probability.
Work with a partner. Make a prediction, compare your reasoning, then identify the rule that supports your answer.
Independent transfer
Design two draws that cannot choose the same list entry twice. Explain what happens if the list has only one entry.
Exit check
Why is RANDOM(1,LENGTH(list)) invalid for an empty list?
Write your reasoning before comparing with a classmate. If your teacher assigned this task, submit it through My classes to save your work and receive feedback.
Check yourself
Your practice so far
Check an answer to see its rationale.