If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Generating 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.
Choose 2 answers:
🤔