Scratch maths: random numbers
Use Scratch projects to use safe random-number blocks to discuss chance and outcomes.
Quick answer
In Scratch maths, random numbers help create unpredictable and exciting outcomes in your projects. When you use the pick random block, it chooses a number from a range you set, like between 1 and 6, making your game or story more interesting and fun.
Learning outcome
By the end of this page, you will understand how to use random numbers in Scratch to create surprising and fun results in your projects. You will be able to:
- Use the pick random block to generate numbers
- Set a range for random numbers (like 1 to 10)
- Apply random numbers in games, stories, or animations
- Understand how random numbers make projects more exciting
Why this matters
Random numbers are used in many things you enjoy every day! Think of games, sports, or even how your morning routine might surprise you. In Scratch, using random numbers helps you create more engaging projects that don’t always follow the same pattern. It’s like adding a little bit of magic to your creations.
For example, in a game where you roll a dice, the number that comes up is random. In Scratch, you can make your own dice that rolls a random number each time you click a button. This makes your game feel alive and unpredictable.
How it works
Using random numbers in Scratch is simple. You just need to:
- Go to the Operators section in the Scratch blocks menu
- Find the pick random block
- Set the range of numbers you want (like from 1 to 10)
- Click the block or connect it to a button to make it work
When you run your project, the block will pick a number from your set range every time. If you pick from 1 to 6, it could be 1, 2, 3, 4, 5, or 6. Each time you press the button, it's a new surprise!
Examples you can see
Imagine you're making a game where a character jumps. You can use random numbers to decide how high the character jumps each time. Here's how:
| Random Number | Jump Height |
|---|---|
| 1 | Small jump |
| 2 | Medium jump |
| 3 | Big jump |
If you set your random block to pick between 1 and 3, your character will jump differently each time. This makes the game more fun and unpredictable.
Another example is a coin toss game. You can use random numbers to decide if the coin lands on heads or tails. If you use numbers 1 and 2:
- 1 = Heads
- 2 = Tails
Every time you click the button, the coin flips to a random side, just like in real life!
Try it as a mini adventure
Let’s go on a mini adventure to make a random number game!
1st time: Open Scratch and create a new project.
2nd time: Add a sprite (like a cat or a character).
3rd time: Add a when green flag clicked block.
4th time: Add a say block and type “Press the space key for a random number!”
5th time: Add a when space key pressed block.
6th time: Add a pick random block inside the space key block.
7th time: Set the range from 1 to 10.
8th time: Add a say block to show the random number.
9th time: Click the green flag and press space to see your random number!
10th time: Try changing the range to 1 to 100 and see what happens!
This simple project teaches you how random numbers work and how to use them in fun ways.
Common mistakes
- Mistake: Forgetting to set the range for the random block.
- Why it happens: The block might pick a number from a default range that’s not what you wanted.
- Fix: Always make sure to set the range, like from 1 to 10, or 1 to 100.
- Mistake: Thinking that random numbers are the same every time.
- Why it happens: Some kids expect the same number to come up each time they press the button.
- Fix: Explain that random means different each time, so it’s not the same number twice.
- Mistake: Not connecting the random block to a button or event.
- Why it happens: The block won’t run unless it's connected to something that triggers it.
- Fix: Make sure to connect the random block to a button or event, like a space key or a click.
Parent and carer guide
Helping your child with random numbers in Scratch can be a fun way to learn math and creativity. Here’s how to support them:
- Encourage your child to experiment with different number ranges. Try 1 to 5, then 1 to 20, and see what happens.
- Ask questions like, “What do you think will happen if you change the numbers?”
- Let them create their own random number games, like a dice game or a coin toss.
- Remind them that random means different every time, so it’s okay if the number changes each time.
- Keep it playful and fun – the goal is to explore and learn!
If your child gets stuck, help them remember to connect the random block to a button or event. This makes the random number show up when they want it to.
Practice questions
- What does the pick random block do in Scratch?
- How do you set a range for a random number?
- Which number will the block pick if you set the range from 1 to 5?
- Can you name a real-world example where random numbers are used?
- What happens if you don’t connect the random block to an event?
Answers:
- It picks a random number from a range you set.
- By typing in the numbers in the block, like from 1 to 10.
- It could be 1, 2, 3, 4, or 5.
- A dice roll or a coin toss.
- It won’t show a random number because nothing triggers it.
FAQ
What is a random number?
A random number is a number chosen without any pattern. It can be any number in a set range, and it changes each time you use it.
How do I use random numbers in Scratch?
You use the pick random block from the Operators menu. Set the range of numbers you want, and connect it to a button or event to make it work.
Why are random numbers important in games?
Random numbers make games more fun and exciting because they create surprise. Players don’t know what will happen next, which keeps them engaged.
Can I use random numbers in my Scratch story?
Yes! You can use random numbers to make your story change each time it runs, like picking a random character or a random event.
What is a good range to start with for random numbers?
Start with small ranges like 1 to 5 or 1 to 10. This makes it easier to see how random numbers work and helps with understanding.