Step 1: Make it
What is it?
Shake your micro:bit to make random numbers
How it works
- Like the Get silly project this program uses the micro:bit’s accelerometer to make something happen when you shake it.
- When you shake your micro:bit, the program selects a random number between 1 and 6 and shows it on the LED display.
- It's really hard for computers to make truly random numbers because they’re machines that work precisely and regularly.
- Make a tally chart of how often each number comes up. Are these numbers really random? Compare it with real dice.
What you need
- micro:bit (or MakeCode simulator)
- MakeCode or Python editor
- battery pack (optional)
- real dice (optional)
Step 2: Code it
Step 3: Improve it
- Make the number appear for a few seconds, then clear the LED display to save batteries.
- Make it roll 2 dice. You can make a random number between 2 and 12, or you can make two random numbers between 1 and 6 and add them together.
- Try both methods and tally how often each score occurs. Does it make a difference? Do some numbers come up more often than others?