Random values introduce unpredictability into programs. Computers generate pseudorandom numbers, which appear random but are produced using algorithms. In AP CSP, RANDOM(a, b) is used to generate integers within a specified range. Randomness is useful for simulations, games, and modeling real-world uncertainty.
Back to Big Idea 3: Algorithms & Programming
Lesson PreviewLesson 15 of 18 in this unit
3.15 Random Values
Part of Big Idea 3: Algorithms & Programming in AP® Computer Science Principles. Read the opening section, then create a free account for the full interactive lesson, practice, and progress tracking.
In this unit
18 lessons
- 3.1Variables and AssignmentsPreview lesson
- 3.2Data AbstractionPreview lesson
- 3.3Mathematical Expressions in ProgrammingPreview lesson
- 3.4StringsPreview lesson
- 3.5Boolean ExpressionsPreview lesson
- 3.6ConditionalsPreview lesson
- 3.7Nested ConditionalsPreview lesson
- 3.8IterationPreview lesson
- 3.9Developing AlgorithmsPreview lesson
- 3.10ListsPreview lesson
- 3.11Binary SearchPreview lesson
- 3.12Calling ProceduresPreview lesson
- 3.13Developing ProceduresPreview lesson
- 3.14LibrariesPreview lesson
- 3.15Random ValuesThis lesson
- 3.16SimulationsPreview lesson
- 3.17Algorithmic EfficiencyPreview lesson
- 3.18Undecidable ProblemsPreview lesson
Continue the full lesson in Stellar
Create a free account to unlock the remaining sections, checkpoints, course practice, and progress tracking for AP® Computer Science Principles.