Using a Random Number

In this activity, you'll use a random number generator in the story.

You've seen special random blocks that were designed especially for this project to generate random jobs, actions, and places. Programming languages (including Snap!) usually have a built-in way to generate random numbers.

  1. If your project isn't open already, open your "Super Short Stories" project by choosing "Open" from the Snap! File menu (File menu button).
  2. Locate pick random (1) to (10) in the palette on the left hand side of the Snap! window, and click it a few times.
  3. Change the inputs to pick random, and click it a few times to see what happens.
  4. Talk with Your Partner Describe what the pick random block does.
  5. Your super short story block may look different depending on the inputs you've used.
    Drag pick random into the number input slot of super short story, and click the super short story block a few times to check that a random number is used in the story. If it isn't working right, work with another student to sort out the problem.
    'super story story' block with 'pick random (3) to (12)' in the 'number' input slot
  6. Save your work
  1. If you haven't already, try using a decimal number as input to the pick random block. If you haven't already, try using only whole numbers.
  2. Talk with Your Partner What happens when you use a whole number as input to pick random? What happens when you use a decimal number?
In this activity, you learned how to generate random numbers and used them to improve the story.