3.15 Random Values
Enduring Understanding
Programmers break down problems into smaller and more manageable pieces. By creating procedures and leveraging parameters, programmers generalize processes that can be reused. Procedures allow programmers to draw upon existing code that has already been tested, allowing them to write programs more quickly and with more confidence.
Learning Objective
For generating random values:
a. Write expressions to generate possible values.
b. Evaluate expressions to determine the possible results.
Essential Knowledge
The exam reference sheet provides
Text: RANDOM(a, b)
Block:
which generates and returns a random integer from a to b, inclusive. Each result is equally likely to occur. For example, RANDOM(1, 3) could return 1, 2, or 3.
Using random number generation in a program means each execution may produce a different result.
Last updated
Was this helpful?