Keep One Sample from a Stream
Maintain one uniform stream sample with controlled replacement probability.
Adult planning suggestion: about 9–12 · Logic & rule checking
- Players
- 2–4; cooperate, then exchange the checker role
- Time
- 15–25 minutes
- Materials
- Paper, pencil and the supplied player sheet; keep the host sheet separate.
Prepare
Read fictional labels A,B,C,D in that order without knowing the final length in advance. One storage slot holds a sampled label; a separate counter i records how many items have arrived.
Follow the rule
Keep the first item. At item i>1 draw a uniform integer from 1 to i: replace the slot with the new item only on 1. Otherwise keep the current slot. Restore and reshuffle the draw cards before each independent draw.
Check each step
For four items use draw decks 1–2,1–3 and 1–4. The one-slot storage limit refers to stream labels, not the teaching probability log. Do not choose whichever current label you like.
Worked example
In a stipulated demonstration the draws are 2,1,3. Record the slot after each item. This demonstration is not evidence that real random runs selected the labels equally often.
Finish and adapt
Finish by enumerating all 24 equally likely draw triples and counting final labels. Each should appear six times. Fair independent draws are an assumption; the paper result is not a validation of an arbitrary coin or sampling device.
Purpose, observation and provenance
Within this activity: Maintain one uniform stream sample with controlled replacement probability.
Ask the checker to name a particular rule and show the recorded evidence. Speed alone is not the goal.
Our rules, examples and printable diagrams are separately prepared. The earliest inventor of the broader mechanism is not established here.
Stanford CS168 · Reservoir Sampling — Mechanism background only. Our small paper instance and role rotation are separate; no endorsement or unique-solution claim.
Secondary practice: Cooperation and explaining a check.
For a class of 30, use ten groups of three. Prepare one player-material set per group and keep the host key with the adult. Rotate operator, recorder and checker after each worked example; a reader or scribe may help without choosing answers. Avoid public ranking or diagnostic labels.
Age bands are planning suggestions. Background references may address older learners and do not validate suitability for this age band. Goals describe observable actions, not measured long-term gains or institutional endorsement.
Free alternative: Copy the supplied grids, labels and cards onto reused paper. No specialist product is needed. Adults may prepare pieces or act as a scribe.
Printable materials
Preview at 100% scale, with browser headers and footers off. Cut with suitable help. Keep host keys separate. This is a manual tabletop kit, not an online opponent, automatic judge or solver.
Keep One Sample from a Stream · Player materials
Read fictional labels A,B,C,D in that order without knowing the final length in advance. One storage slot holds a sampled label; a separate counter i records how many items have arrived.
Keep the first item. At item i>1 draw a uniform integer from 1 to i: replace the slot with the new item only on 1. Otherwise keep the current slot. Restore and reshuffle the draw cards before each independent draw.
For four items use draw decks 1–2,1–3 and 1–4. The one-slot storage limit refers to stream labels, not the teaching probability log. Do not choose whichever current label you like.
| Incoming item / 到项 | i | Draw range / 抽域 |
|---|---|---|
| A | 1 | keep / 保留 |
| B | 2 | 1–2 |
| C | 3 | 1–3 |
| D | 4 | 1–4 |
| Step / cell | Decision / value | Rule checked |
|---|---|---|
| ________ | ________ | ________ |
| ________ | ________ | ________ |
| ________ | ________ | ________ |
| ________ | ________ | ________ |
Keep One Sample from a Stream · Host key — keep separate
Stipulated slot sequence A,A,C,C. Over all2×3×4=24 equally likely triples each final label occurs6 times, probability1/4.
Lead and check
Read fictional labels A,B,C,D in that order without knowing the final length in advance. One storage slot holds a sampled label; a separate counter i records how many items have arrived.
Keep the first item. At item i>1 draw a uniform integer from 1 to i: replace the slot with the new item only on 1. Otherwise keep the current slot. Restore and reshuffle the draw cards before each independent draw.
For four items use draw decks 1–2,1–3 and 1–4. The one-slot storage limit refers to stream labels, not the teaching probability log. Do not choose whichever current label you like.
In a stipulated demonstration the draws are 2,1,3. Record the slot after each item. This demonstration is not evidence that real random runs selected the labels equally often.
Finish by enumerating all 24 equally likely draw triples and counting final labels. Each should appear six times. Fair independent draws are an assumption; the paper result is not a validation of an arbitrary coin or sampling device.
Classroom: ten trios for 30 learners; one kit per trio. Rotate operator, recorder and checker. Age guidance is a planning suggestion; prerequisite support may be necessary.