We can generate a random number between any two whole numbers using the random
block:
This block generates numbers with about equal likelihood, and can generate
both the lower and upper bounds that you give it. So,
can generate 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10.
This block (and others with round edges) is a reporter block—it reports a value. Use this block inside other blocks that take an input:
This program
simulates a six sided die that rolls every time you click on it.
(You can look in the Costumes
area—click the tab
above the script—to see the six costumes that the random
number is using).