Use Calculator Integers to Simulate Birthday Groups
In What Is a Probability Simulation and Setting Up a Simulation Model, you learned to define a trial, its possible outcomes, and the event of interest. In Using a Random Digit Table, you applied fixed reading rules to generate outcomes. A TI-84 can generate those chance outcomes for you: its randInt command produces random integers in a specified range.
To keep the example manageable, imagine a calendar with only six possible birthdays, labeled 1 through 6. A trial consists of four people, each assigned a birthday. The event of interest is that at least two people have the same birthday. A trial is a match if any birthday label occurs more than once in that group.
The six labels are a simplified model, not a claim about real birthdays. The model assumes each of the six dates is equally likely for each person, and that one person’s assigned birthday does not affect another person’s. These assumptions define the chance process the simulation imitates.
Generate One Group with randInt(1,6,n)
On a TI-84, the command randInt(lower, upper, number of values) generates the requested number of integers, including both endpoints. Thus, randInt(1,6,4) produces four integers from 1 through 6. Those four values are the birthdays for one trial. The number 4 here is the number of people in the group; it is not the number of simulated groups.
The calculator displays a list of four values. Check that list for a repeated label. It does not matter which people have the matching birthdays or whether a label occurs two or more times: any repeat means the event occurred. Then run the command again for a new group. Start each new group with the full set of six possible birthdays; do not remove labels that appeared in an earlier trial.
Some TI-84 models or software versions may display the command slightly differently, but the input and meaning are the same. Use the calculator’s MATH menu and probability submenu to select randInt(, then enter the lower endpoint, upper endpoint, and count. For a group of four, enter 1, 6, and 4 in that order.
Worked Example: Decide Whether One Calculator-Generated Group Has a Match
Suppose the calculator returns the list \(\{2,5,2,6\}\) after entering randInt(1,6,4). Determine whether the birthday event occurs.
Read the list as one trial: The four labels represent four people’s birthdays: 2, 5, 2, and 6.
Check for a repeat: Label 2 appears twice. Therefore, at least two people share a birthday, so the event occurs in this trial.
Record one “yes” for this group. The two appearances of label 2 are not an error or a value to reject. They represent two different people who have the same birthday.
Generate Several Trials and Record Outcomes
A single group shows how the command works, but one simulated group cannot provide a stable estimate of the event’s probability. To estimate it, repeat the same trial many times and record whether the event occurs in each group. Keep the group size, birthday labels, and matching rule unchanged from trial to trial.
The outcome you count is the group, not each person and not each repeated birthday. For example, a group with three people sharing one label still contributes one event occurrence, because the event is simply “at least two share a birthday.” When the trials are complete, divide the number of groups with a match by the total number of groups.
This relative frequency is an estimate based on the trials you ran. As discussed in The Law of Large Numbers in Simulations, results from more repeated trials generally settle closer to the probability in the model, although any particular run can vary.
Worked Example: Estimate the Chance of a Match in Four-Person Groups
A student wants to estimate the chance that at least two people share a birthday in a group of four, when birthdays are modeled as equally likely to be one of six dates. The student runs randInt(1,6,4) repeatedly. The following lists are illustrative calculator output from 12 simulated trials.
Do: Classify each list and count the “yes” results.
| Trial | Generated birthdays | Match? |
|---|---|---|
| 1 | 1, 4, 2, 6 | No |
| 2 | 3, 3, 5, 1 | Yes |
| 3 | 6, 2, 4, 1 | No |
| 4 | 5, 2, 5, 3 | Yes |
| 5 | 4, 1, 6, 2 | No |
| 6 | 2, 6, 2, 4 | Yes |
| 7 | 1, 3, 5, 6 | No |
| 8 | 4, 4, 2, 5 | Yes |
| 9 | 6, 1, 3, 2 | No |
| 10 | 5, 1, 1, 4 | Yes |
| 11 | 2, 3, 6, 5 | No |
| 12 | 3, 6, 4, 3 | Yes |
There are six “yes” results among the 12 trials. Substituting these counts into the relative-frequency formula gives:
Use randInt(0,9) with a Rejection Rule
You can also build birthday labels from single random digits. The TI-84 command randInt(0,9) produces one integer from 0 through 9. However, there are ten possible digits and only six birthday labels. Assigning some digits to one birthday and more digits to another would make the dates unequally likely.
Instead, use 0 through 5 and reject 6 through 9. Map each accepted digit to a birthday label by adding 1: 0 represents birthday 1, 1 represents birthday 2, and so on through 5 representing birthday 6. If the command returns 6, 7, 8, or 9, discard that digit and draw again for the same person. Continue until four accepted digits have been mapped to birthdays.
- Use digits 0–5 as the six birthday outcomes, with each digit assigned to a different birthday.
- Reject digits 6–9 and draw again for the birthday that is still needed.
- Keep accepted repeated labels; different people may share a birthday.
- Stop after four accepted labels to finish one group, then begin a fresh group for the next trial.
This rejection rule keeps the six modeled dates equally likely: each date corresponds to exactly one of the six accepted digits. Some draws are discarded, so this method may take more calculator entries than directly using randInt(1,6,4). Do not treat a rejected digit as a person or as a birthday.
Worked Example: Make a Birthday Group from Single Random Digits
For one group of four people, suppose repeated uses of randInt(0,9) produce the sequence 8, 3, 0, 5, 7, 0. Apply the rejection and mapping rules in order.
Process the first digit: Reject 8 because it is in the unused range 6–9. No birthday has been assigned yet.
Continue until four birthdays are assigned: Accept 3 and map it to birthday 4. Accept 0 and map it to birthday 1. Accept 5 and map it to birthday 6. Reject 7 because it is unused. Accept the final 0 and map it to birthday 1.
| Digit | Action | Birthday label, if accepted |
|---|---|---|
| 8 | Reject | — |
| 3 | Accept | 4 |
| 0 | Accept | 1 |
| 5 | Accept | 6 |
| 7 | Reject | — |
| 0 | Accept | 1 |
The completed group is 4, 1, 6, 1. Birthday 1 appears twice, so this trial has a match. The second accepted 0 is used rather than skipped: it represents another person with birthday 1.
Common Mistakes and AP Exam Tips
- Confusing people with trials. In randInt(1,6,4), the final 4 generates four birthdays for one group. To simulate more groups, repeat the command and record one result per group.
- Removing a repeated birthday. The model allows two people to have the same date. Skipping a repeat would change the chance process and could prevent the event you are trying to record.
- Counting matches instead of groups. A group with several repeated labels is still one trial. Record whether the event happened, then count that trial once.
- Using all ten digits as if there were six outcomes. For the randInt(0,9) method, digits 6–9 must be rejected. Otherwise the six dates will not have equal chances under the digit assignment.
- Starting a new trial with a restricted set of labels. Each simulated group represents new people whose birthdays can be any of the six dates. Do not remove a birthday label after it appears in an earlier group.
- Calling a short-run frequency the exact probability. State how many simulated groups had a match and how many groups were run. Describe the ratio as an estimate from that simulation, not as a guaranteed exact value.
A complete simulation description names the model, the number of people in one trial, the calculator command or digit-mapping rules, the event being recorded, and how the results will be summarized. For this example, a clear report says that four birthdays are generated per trial, any repeated label counts as a match, and the number of matching groups is divided by the total number of groups.
Check Your Understanding
Use the six-date, four-person birthday model unless a question states otherwise.
- What does the final argument 4 represent in randInt(1,6,4)?
- A generated group is 2, 6, 2, 4. Does the event occur? What should be recorded for that trial?
- When using randInt(0,9), what should you do if the digit is 7? Should that digit count as one of the four birthdays?
- In 30 simulated groups, 18 contain a match. What is the estimated probability from those trials?
- Why is it appropriate to keep the same birthday label if it appears for a second person in a group?