Randomizing image position in a slide object

Michiel Spape Michiel.Spape at nottingham.ac.uk
Tue Feb 23 10:34:03 UTC 2010


I think you meant Tobias, who wrote

dim x as integer
x = random(1,3)
if x = 1 then c.setattrib "posX", 200
if x = 2 then c.setattrib "posX", 400
if x = 3 then c.setattrib "posX", 600

...rather than my...

Dim Locs() as integer
Dim i as integer
For i = 1 to 640
        Locs(i) = i
Next i
RandomizeArray Locs     

As I tried to explain usage of RandomizeArray... Still, my choice for your example, without randomized arrays would be:

dim x as integer
c.SetAttrib "posX", 200 * random(1,3)

Hatsekidee! 
Cheers,
Mich

Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology


-----Original Message-----
From: e-prime at googlegroups.com [mailto:e-prime at googlegroups.com] On Behalf Of David McFarlane
Sent: 22 February 2010 18:30
To: e-prime at googlegroups.com
Subject: Re: Randomizing image position in a slide object


> > Well, have an inline like this before the display appears:
> >
> > dim x as integer
> > x = random(1,3)
> > if x = 1 then c.setattrib "posX", 200
> > if x = 2 then c.setattrib "posX", 400
> > if x = 3 then c.setattrib "posX", 600

Just can't let this sit (even though Mich & I disagree on this point 
of programming style :) ), so here is the same code in two more 
different styles:

dim x as integer
x = random(1,3)
if x = 1 then
     c.setattrib "posX", 200
elseif x = 2 then
     c.setattrib "posX", 400
elseif x = 3 then
     c.setattrib "posX", 600
end if

or

dim x as integer
select case random(1,3)
   case 1
     c.setattrib "posX", 200
   case 2
     c.setattrib "posX", 400
   case 3
     c.setattrib "posX", 600
end select

-- David McFarlane, Professional Faultfinder

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list