Main content
Course: AP??/College Computer Science Principles?>?Unit 6
Lesson 2: Simulating randomnessGenerating random numbers
Problem
A game developer is working on a soccer video game.
This incomplete code segment is run when a player attempts a goal from outside the 6 yard box:
inGoal ← false
IF (<MISSING CONDITION>)
{
inGoal ← true
DISPLAY("Goal!")
}
ELSE
{
DISPLAY("Miss!")
}
At that distance, the code should give the player a 30% chance of making the goal.
Which of these can replace
<MISSING CONDITION>
so that the code works as intended???Note that there are 2 answers to this question.
?
Related content