What this deck covers
This deck focuses on Random Values, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science Principles.
Study Random Values in AP Computer Science Principles with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.
0% Complete
Which option best describes the sequence produced by a PRNG?
Tap card or press Space to flip
Deterministic and reproducible with the same seed. Mathematical algorithms ensure consistent behavior across runs.
How well did you know it?
Card 1 / 58
Space to flip · ← / → to move · once flipped, → Got it · ← Still learning
This deck focuses on Random Values, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science Principles.
Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.
Answer: Deterministic and reproducible with the same seed. Mathematical algorithms ensure consistent behavior across runs.
Answer: random.shuffle(list). Randomly reorders elements using Fisher-Yates algorithm internally.
Answer: Correct: Yields floats, not integers. Uniform distribution produces continuous values, not discrete integers.
Answer: PRNGs are algorithm-based; TRNGs are based on physical processes. PRNGs use math; TRNGs use unpredictable physical phenomena.
Answer: An algorithm that produces a sequence of numbers with no discernible pattern. Uses mathematical algorithms to simulate unpredictable sequences.
Answer: PRNGs are algorithm-based; TRNGs are based on physical processes. PRNGs use math; TRNGs use unpredictable physical phenomena.
Answer: setSeed(long seed). Resets internal state to produce new random sequence.
Answer: setSeed(long seed). Resets internal state to produce new random sequence.
Answer: A double value between 0.0 (inclusive) and 1.0 (exclusive). Standard uniform distribution used in most random calculations.
Answer: Correct: It produces the same sequence. Deterministic algorithms always repeat with identical starting conditions.
Answer: Correct: Generates either 0 or 1, not a decimal. Random integers are discrete values, not continuous decimals.
Answer: 0 to RAND_MAX. RAND_MAX is typically 32767 or larger depending on implementation.
Answer: random.shuffle(list). Randomly reorders elements using Fisher-Yates algorithm internally.
Answer: Returns a k-length list of unique elements from the population. Sampling without replacement ensures no duplicate elements.
Answer: Selects k elements with given weights. Weighted selection allows different probabilities for each element.
Answer: Returns a k-length list of unique elements from the population. Sampling without replacement ensures no duplicate elements.
Answer: A double value between 0.0 (inclusive) and 1.0 (exclusive). Standard uniform distribution used in most random calculations.
Answer: To initialize the random number generator, ensuring reproducibility. Same seed produces identical sequences for testing and debugging.
Answer: They are generated by a deterministic algorithm. Mathematical formulas create sequences that appear random but are predictable.
Answer: random(a,b)=a+(rand()%(b−a+1)). Modulo operation constrains range to desired integer bounds.
Answer: random.choice(sequence). Works with any sequence type including lists, tuples, strings.
Answer: True random number generator (TRNG). Uses hardware entropy like thermal noise or radioactive decay.
Answer: Deterministic and reproducible with the same seed. Mathematical algorithms ensure consistent behavior across runs.
Answer: A randomly selected element from the list. Picks one item randomly from the sequence with equal probability.
Answer: Correct: Gives a number 0-10. Multiplication scales from [0,1) to [0,10) range.
Answer: A randomly selected element from the list. Picks one item randomly from the sequence with equal probability.
Answer: Always returns 5. Single value range always returns that exact value.
Answer: Seeds the random number generator. Initializes the random sequence starting point for reproducibility.
Answer: Selects k elements with given weights. Weighted selection allows different probabilities for each element.
Answer: 0 to RAND_MAX. RAND_MAX is typically 32767 or larger depending on implementation.
Answer: Seeds generator with current time or system state. Uses entropy from system clock or hardware for unpredictability.
Answer: Correct: Generates either 0 or 1, not a decimal. Random integers are discrete values, not continuous decimals.
Answer: True random number generator (TRNG). Uses hardware entropy like thermal noise or radioactive decay.
Answer: random.random(). Base function for generating uniform floating-point distributions.
Answer: An integer between 1 and 10 inclusive. Inclusive bounds mean both endpoints can be returned.
Answer: To initialize the random number generator, ensuring reproducibility. Same seed produces identical sequences for testing and debugging.
Answer: random.random(). Base function for generating uniform floating-point distributions.
Answer: An algorithm that produces a sequence of numbers with no discernible pattern. Uses mathematical algorithms to simulate unpredictable sequences.
Answer: Correct: Gives a number 0-10. Multiplication scales from [0,1) to [0,10) range.
Answer: Correct: Yields floats, not integers. Uniform distribution produces continuous values, not discrete integers.
Answer: Correct: It produces the same sequence. Deterministic algorithms always repeat with identical starting conditions.
Answer: The random number generator function. Built-in functions like rand() or random() provide pseudorandom values.
Answer: random.uniform(a, b). Generates continuous floating-point values within specified bounds.
Answer: random.choice(sequence). Works with any sequence type including lists, tuples, strings.
Answer: They are generated by a deterministic algorithm. Mathematical formulas create sequences that appear random but are predictable.
Answer: random.uniform(a, b). Generates continuous floating-point values within specified bounds.
Answer: The random number generator function. Built-in functions like rand() or random() provide pseudorandom values.
Answer: Initializes the random number generator with seed x. Sets starting state for predictable random sequence generation.
Answer: A random number from the specified range. Similar to range() but returns random value from sequence.
Answer: random(a,b)=a+(rand()%(b−a+1)). Modulo operation constrains range to desired integer bounds.
Answer: A random number from the specified range. Similar to range() but returns random value from sequence.
Answer: An integer between 1 and 10 inclusive. Inclusive bounds mean both endpoints can be returned.
Answer: Initializes the random number generator with seed x. Sets starting state for predictable random sequence generation.
Answer: Always returns 5. Single value range always returns that exact value.
Answer: 0.0 (inclusive) to 1.0 (exclusive). Standard range for most programming language random functions.
Answer: Seeds generator with current time or system state. Uses entropy from system clock or hardware for unpredictability.
Answer: Seeds the random number generator. Initializes the random sequence starting point for reproducibility.
Answer: 0.0 (inclusive) to 1.0 (exclusive). Standard range for most programming language random functions.