Random Number Generation Flashcards

Card 1 of 4

All 4 cards in this deck

What is a random number in a program?

A number generated within a specified range that cannot be predicted.

Give two uses of random number generation in programs.

Any two: games of chance such as dice rolls; generating secure passwords; avoiding data collisions in network transmission.

What does random(1, 6) return in OCR Exam Reference Language?

A random integer from 1 to 6, with both 1 and 6 included.

What does random(2.5, 4.5) return in OCR Exam Reference Language?

A random real number from 2.5 to 4.5, both included. random() gives a real when given reals and an integer when given integers.