Turtle Fun - Lesson Twelve

And now for something completely different but, don't worry, we'll come back to the tree! To see just how different, have a look at this! Maybe the turtle got a little drunk!

All I did was to tell the turtle to take one thousand size 10 steps BUT, after each step, turn any angle you like. And how did I do that? With a new turtle word, random. As usual, the number after this word tells the turtle how big.
So random 6 produces 0, 1, 2, 3, 4 or 5.
random 3 produces 0, 1 or 2.
random 20 produces 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 or 19.
It's just like throwing dice - we don't know which number will come up.

So here's how I got the drunken turtle:

cg pd repeat 1000 [forward 10 right random 360]

Exercise 22 Type this line into the Command Center and do it over and over again. Did you realise that you can make the turtle do the same line again by just clicking on the line and pressing the Enter key?