1. Exam Points
Generate a random value between a specified range.Determine the range of RANDOM(min, max).
2. Knowledge Points
(1) Generate Random Values
- CSP provides the
random procedureto generate and returna random integer from a to b, inclusive(a<= x <=b). - Each result is equally likely to occur.
- For example, RANDOM(1, 3) could return 1, 2, or 3.
Syntax:
Example:
- x ← RANDOM(1,4)
- x can be 1, 2, 3, or 4 with a equal chance.