Lesson goal: Make it snow

Previous: Numbers ending in 1 | Home | Next: Graph a line in slope-intercept form

One of the classic graphics jobs is to make it "snow" on the screen. This is done with a for loop counting to around 100 or 1000 or so, then plotting a dot at a random position on the screen each time. Review how to find a random number before proceeding, in case you forgot.

Now you try. Try fixing the for statement to do a proper count from 1 to some number, then fix the math.random statements.

Type your code here:

See your results here:

This code will not run. You have to fix the for i=1, do statement to have a maximum value to count to (try 100). Next, you have to set lower and upper limits for the math.random statements for the x= and y= lines. Hint: On the graphics screen, goes from about -220 to +220, and y goes from -115 to +115. Dismiss.
Show a friend, family member, or teacher what you've done!

Here is a share link to your code:

Does your code work? Want to run it on your iPhone?

Here's your code:

  1. Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.

  2. Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into this page

  3. Then click the "Use on iPhone" button that you'll see.