Random Number Generator

A random number generator is a tool that produces numbers with no predictable pattern, used in AP Stats to select simple random samples (numbering individuals and generating numbers, ignoring repeats) and to randomly assign treatments to experimental units, which removes selection bias.

Verified for the 2027 AP Statistics examLast updated June 2026

What is Random Number Generator?

A random number generator (RNG) is a calculator function, app, or table that spits out numbers no one can predict better than chance. In AP Stats, it's not a vocabulary word you define so much as a tool you use. The CED names it directly in two places. In Topic 3.3, an RNG is one of the standard mechanisms for getting a simple random sample (SRS). You number every individual in the population, generate random numbers, and ignore repeats since you're sampling without replacement. In Topics 3.5 and 3.6, an RNG is one of the accepted methods for randomly assigning treatments to experimental units in a completely randomized design, alongside a table of random values or drawing chips.

The whole point is removing human choice. The moment a researcher picks 'whichever students walk by' or 'the plants that look healthiest,' bias creeps in. An RNG hands the selection over to chance, which is what makes every group of a given size equally likely to be chosen (the actual definition of an SRS) and what tends to balance confounding variables across treatment groups in an experiment.

Why Random Number Generator matters in AP Statistics

This term lives in Unit 3: Collecting Data, threading through Topics 3.3, 3.5, and 3.6. It supports AP Stats 3.3.A (identifying sampling methods, since the SRS mechanism is literally 'numbering individuals and using a random number generator'), 3.5.B (random assignment is one of the four elements of a well-designed experiment), and 3.5.C (an RNG is a named method for assigning treatments in a completely randomized design). Here's the big-picture payoff. Random selection with an RNG is what lets you generalize from sample to population, and random assignment with an RNG is what lets you claim cause and effect. Those two inferences are the backbone of everything you do later in Units 6-9, so the RNG is quietly the tool that makes the entire second half of the course legitimate.

How Random Number Generator connects across the course

Random Sampling (Unit 3)

An SRS isn't magic; it needs a mechanism, and the RNG is the most common one. Number everyone 1 to N, generate numbers, skip repeats. If every group of a given size has an equal shot at being picked, you have an SRS.

Completely Randomized Design (Unit 3)

Same tool, different job. Instead of picking who's in the study, the RNG decides which treatment each experimental unit gets. That random assignment is what balances confounding variables so differences in the response can be attributed to the treatments.

Bias (Unit 3)

Bias comes from systematic human choices in selection. An RNG eliminates the 'systematic' part by making every choice pure chance, which is exactly why the CED treats it as the gold-standard selection mechanism.

Confounding Variable (Unit 3)

You can't control variables you don't know exist. Random assignment via RNG spreads unknown confounders roughly evenly across treatment groups, which is the only defense against lurking variables you never measured.

Is Random Number Generator on the AP Statistics exam?

Random number generators show up constantly in Unit 3 multiple choice, usually in stems asking whether a described procedure actually produces an SRS. A classic trap describes a researcher using an RNG but mishandling repeats or restricting which numbers can come up, then asks what's problematic about the procedure. On FRQs, this is a Question 2 staple. The 2019 (fungus and insects), 2022 (twins and acne drug), 2023 (concrete fibers), and 2025 (aphids in a cabbage field) exams all asked for experimental design descriptions where random assignment is required. To earn credit, you describe a complete, repeatable process. Say something like 'label the 36 units 1 through 36, use a random number generator to produce numbers from 1 to 36, ignoring repeats, and assign the first 18 selected to Treatment A and the rest to Treatment B.' Vague answers like 'randomly split them into groups' lose points because the grader can't actually carry out your method.

Random Number Generator vs Random Sampling

Random sampling is a method; the random number generator is the tool that carries it out. And the same tool does two very different jobs that you must keep straight. Using an RNG to SELECT individuals from a population (random sampling) lets you generalize results to that population. Using an RNG to ASSIGN treatments to units already in the study (random assignment) lets you conclude cause and effect. An experiment can have random assignment without random sampling, and a survey can have random sampling with no treatments at all.

Key things to remember about Random Number Generator

  • A random number generator produces numbers with no predictable pattern, removing human choice (and therefore bias) from selection and assignment.

  • To get an SRS with an RNG, number every individual in the population, generate random numbers, and ignore repeats because you're sampling without replacement.

  • In a completely randomized design, an RNG is a CED-approved method for assigning treatments to experimental units, along with random digit tables and drawing chips.

  • Random assignment via RNG balances confounding variables across groups, which is what allows cause-and-effect conclusions from an experiment.

  • On FRQs, describe the RNG process step by step (label units, generate numbers, handle repeats, state the assignment rule) so someone else could replicate it exactly.

  • Random sampling supports generalizing to a population, while random assignment supports causal claims, and an RNG can power either one.

Frequently asked questions about Random Number Generator

What is a random number generator in AP Stats?

It's a tool (calculator function, app, or table) that produces numbers with no predictable pattern. In Unit 3 you use it for two jobs, selecting a simple random sample from a population and randomly assigning treatments to experimental units.

Does using a random number generator automatically give you a simple random sample?

No. The RNG is only part of the procedure. You also need every individual numbered, every number equally likely, and repeats ignored (sampling without replacement). AP multiple choice loves to describe a flawed RNG procedure and ask why it fails to produce an SRS.

How is random sampling different from random assignment if both use a random number generator?

Random sampling uses the RNG to pick WHO is in the study, which lets you generalize to the population. Random assignment uses the RNG to decide which treatment each unit gets, which lets you make cause-and-effect conclusions. Same tool, completely different inferences.

How do I describe a random number generator procedure on an AP Stats FRQ?

Be specific enough that a stranger could replicate it. For example, label the 40 units 1 through 40, generate random integers from 1 to 40 ignoring repeats, and assign the first 20 numbers selected to Treatment A and the remaining 20 to Treatment B. Design FRQs like 2022 Q2 (twins acne study) and 2023 Q2 (concrete fibers) reward exactly this level of detail.

Do I ignore repeats when using a random number generator?

Yes, whenever you're sampling or assigning without replacement, which is the usual case. Each individual can only be selected once, so if the RNG produces a number you've already used, skip it and generate again.