Probability is the measure of how likely an event is to occur, expressed as a number from 0 to 1. In AP Computer Science A, probability shows up through code, not formulas: you use Math.random() to simulate chance events, like a light turning on 40% of the time or a bear raiding a bird feeder.
Probability is the branch of math that puts a number on uncertainty. An event with probability 0 never happens, an event with probability 1 always happens, and everything else lives in between (a 25% chance is a probability of 0.25).
Here's the AP CSA twist. You will never be asked to derive a probability formula on this exam. Instead, you're asked to simulate probability in Java. The tool for that is Math.random(), which returns a double that is greater than or equal to 0.0 and strictly less than 1.0. Because that value is uniformly spread across [0.0, 1.0), the expression Math.random() < p is true exactly p of the time. That one line is how Java code says "this event happens with probability p." Scale and shift the value, like (int)(Math.random() * 6) + 1, and you've simulated a die roll. On the AP exam, probability is a coding skill, not a math skill.
Probability isn't its own topic in the AP CSA course description, but the skill behind it absolutely is. The CED expects you to use methods of the Math class, including Math.random(), and to write expressions that produce random values in a specified range. That skill gets introduced early (Unit 2, Using Objects) and then keeps resurfacing whenever a question builds a simulation.
And the College Board loves simulations. The 2024 FRQ Q1 modeled birds (and possibly a bear) eating from a feeder, where how much food disappears each day depends on chance. The 2019 FRQ Q4 (LightBoard) asked for a constructor that initializes a 2D grid of lights, turning each one on or off randomly. In both cases, the question hands you a real-world chance event and grades whether your Math.random() expression matches the stated probability and range exactly. Off-by-one range errors are one of the most common ways to lose FRQ points.
Keep studying AP Computer Science A Unit 4
Random Variables (Unit 2)
A random variable is just a number whose value depends on chance, and that's exactly what Math.random() produces. Every CSA simulation question is secretly asking you to build a random variable with the right range, like "an integer from 10 to 50" via (int)(Math.random() * 41) + 10.
Statistics (Units 2-4)
Probability and statistics are two directions on the same road. Probability starts with a model and predicts outcomes; statistics starts with data and works backward to the model. In CSA you run a probability simulation many times (with loops) and the results you collect, like averages and counts, are statistics.
Linear Search (Unit 7)
Probability sneaks into algorithm analysis through average-case behavior. If the target is equally likely to be anywhere in the array, linear search checks about half the elements on average. That "on average" is a probability statement.
Discrete Math (Units 2 & 4)
The probability you simulate in CSA is discrete probability, meaning countable outcomes like coin flips, die rolls, or a light being on or off. Discrete math is the shared foundation under both probability and the Boolean logic you use to test those random outcomes.
Probability shows up two ways. In multiple choice, you'll see a stem like "which expression produces a random integer between 3 and 10, inclusive?" and you have to evaluate Math.random() expressions, paying close attention to the [0.0, 1.0) range, the multiplier, the shift, and the (int) cast. In free response, probability arrives dressed up as a simulation. The 2024 FRQ Q1 had you simulate animals eating random amounts of food from a feeder day by day. The 2019 FRQ Q4 had you write a LightBoard constructor that randomly sets each light in a 2D array to on or off. The graded skill is always the same: translate a stated chance ("each light has a given probability of being on") into a correct boolean test like Math.random() < p, and translate a stated range into the right scale-and-shift arithmetic. You never compute a probability by hand; you encode it.
Probability reasons forward from a known model to predict outcomes ("if the bear shows up 5% of days, what happens?"). Statistics reasons backward from observed data to estimate the model ("the bear showed up 6 times in 100 days, so the rate is about 6%"). AP CSA only asks you to do the probability side, and only through code: given a stated likelihood, write the Math.random() expression that simulates it. Inference from data belongs to AP Statistics, not this exam.
Probability is a number from 0 to 1 measuring how likely an event is, and in AP CSA you simulate it with code instead of calculating it with formulas.
Math.random() returns a double that is at least 0.0 and strictly less than 1.0, never exactly 1.0.
To simulate an event that happens with probability p, write the boolean test Math.random() < p, which is true exactly p of the time.
To get a random integer from min to max inclusive, use (int)(Math.random() * (max - min + 1)) + min, and double-check the range because off-by-one errors cost FRQ points.
Released FRQs use probability inside simulations, like the 2024 bird feeder question and the 2019 LightBoard constructor that randomly turns lights on or off.
Probability also explains average-case algorithm behavior, like linear search checking about half the array when the target's position is random.
It's the measure of how likely an event is, from 0 (never) to 1 (always). In AP CSA you don't calculate probabilities mathematically; you simulate them in Java using Math.random(), like writing Math.random() < 0.4 for an event with a 40% chance.
Yes, but not as a math topic. It's tested as a coding skill: writing Math.random() expressions that match a stated chance or range. The 2024 FRQ Q1 (bird feeder simulation) and 2019 FRQ Q4 (LightBoard) both required exactly this.
No. There are no probability formulas on this exam. The only things to memorize are that Math.random() returns a double in [0.0, 1.0), that Math.random() < p simulates probability p, and the scale-and-shift pattern (int)(Math.random() * range) + min for random integers.
Probability predicts outcomes from a known model; statistics infers the model from collected data. AP CSA only needs the probability direction, expressed in code. Working backward from data is AP Statistics territory.
No, and this trips up a lot of people. Math.random() returns values from 0.0 up to but not including 1.0. That's why (int)(Math.random() * 6) gives integers 0 through 5, never 6, and why range questions on the MCQ section hinge on this detail.