Random Number Generation (OCR GCSE Computer Science): Quizzes
📚Quizzes
Practise the questions
12 questions from this quiz
ShowHide
Practise the questions
12 questions from this quiz
What is random number generation?
What is random number generation?
Producing unpredictable numbers in a range
Which of these is a common use for random numbers in programming?
Which of these is a common use for random numbers in programming?
Games and simulations
Which Python module is used to generate random numbers?
Which Python module is used to generate random numbers?
random
What range does random.randint(1, 10) generate in Python?
What range does random.randint(1, 10) generate in Python?
Between 1 and 10
What range does random.random() generate in Python?
What range does random.random() generate in Python?
Between 0.0 and 1.0
Which Java class is used to generate random numbers?
Which Java class is used to generate random numbers?
Random
In pseudocode, what does RANDOM(1, 6) simulate?
In pseudocode, what does RANDOM(1, 6) simulate?
Rolling a dice
Why are random numbers useful in programs?
Why are random numbers useful in programs?
They add unpredictability
What does random.randint(1, 2) simulate in a coin flip program?
What does random.randint(1, 2) simulate in a coin flip program?
Choosing between heads or tails
How many random numbers does [random.randint(1, 100) for _ in range(5)] generate?
How many random numbers does [random.randint(1, 100) for _ in range(5)] generate?
5 random numbers
Which Python function shuffles items in a list randomly?
Which Python function shuffles items in a list randomly?
random.shuffle()
Which function generates a random integer within a range in Python?
Which function generates a random integer within a range in Python?
random.randint()
