A fair prize
ChallengeChance
A mystery box in your game should give a prize about half the time. This script tests the box 100 times, but the chance is wrong.
What should happen
- The script opens the box 100 times.
- About half the time there is a prize.
- So the log says a number near 50.
What happens now
The log says a number near 10. The chance is 1 in 10. Players would open box after box and get nothing.
| The chance now | Tries | The sum | Prizes we expect |
|---|---|---|---|
| 1 in 10 | 100 | 100 ÷ 10 | 10 |
How to fix it
Work out which chance gives about 50 prizes in 100 tries.
| You want | Tries | The sum | So the chance is |
|---|---|---|---|
| About 50 | 100 | 100 ÷ ? is 50 | 1 in ? |
Then change the script:
- Press Code, at the top left of the code box, if it is not picked already.
- Find the line
if a 1 in 10 chance. - Change the 10 to your answer.
Test it
Press Run. The goal under the code box gets a tick when the prizes are between 35 and 65.
Why not exactly 50? Because chance never gives exactly what we expect. The test leaves a margin, like you did with your jumps.

