[MWForum]RE: random numbers with setpos

Daniel Ajoy mwforum@lists.mathcats.com
Mon, 09 Feb 2004 12:39:18 -0500


On 9 Feb 2004 at 11:33, Wendy Petti wrote:

> Example 1:
> setpos random 200 random 200

setpos random 200 random 200
setpos does not like 4 as input


This is the correct command:

setpos list random 200 random 200

or these:

setpos sentence random 200 random 200
setpos se random 200 random 200
setpos (se random 200 random 200)
setpos (list random 200 random 200)



> (This command would only place the turtle in the upper right quadrant.)
> 
> * * *
> 
> Example 2:
> setpos -250 + random 500 setpos -150 + random 300

setpos -250 + random 500 setpos -150 + random 300
setpos does not like 150 as input

Same thing here:

setpos list -250 + random 500 setpos -150 + random 300


> Example 3:
> setpos (se -250 + random 500 -150 + random 300)
> 
> (This command does *exactly* the same thing as Example 2, using se
> (sentence) instead of list.  Note that when when more than 2 inputs are
> being combined using SE, then the SE command and its inputs need to be
> enclosed in parentheses.)

But that is not the case here:

setpos se -250 + random 500 -150 + random 300

works just as well because 

setpos se -250 + random 500 -150 + random 300

is the same thing as:

setpos se (-250 + random 500) (-150 + random 300)


Daniel
OpenWorld Learning