Random Lines

  • The random function gives you a random number.

  • random(63) gives you a floating point random number between 0 and 62.

  • To return an integer, you would type: (int) random(63)

  • For example, the command:

point(random(30) , random(50) );

would draw a point in the left top corner of the screen, within a width between 0-29 and a height between 0-49.

  • Write a program that will draw 10 lines in random locations on the screen and at random lengths.