At 12:37 13.02.2001 -0800, R Kumar wrote:
>Hi
>
>I have a field which has 4 possible answers to a
>question. How do i randomly change the order in which
>the answers
>appear, when the user enters the screen. Or is it
>advisable to do it with a list.
>
>Any help would be appreciated.
>
>ravi

ravi,

as a rule I always use fields for display only and keep any computations in 
variables for speed reasons. And what you need here can be done easily with 
a list:

on sortListAtRandom dL
   -- creates a linear list with the
   -- input list's items in random position

   if dL.ilk <> #list then return
   LTemp=[]

   repeat with index = dL.count down to 1
     LTemp.addat( random(LTemp.count + 1),dL[index] )
   end repeat

   return LTemp
end


from the messWin:

-- Welcome to Director --
dL = [1,2,3,4,5,6,7,8,9]


put sortListatRandom(dL)
-- [6, 3, 7, 2, 9, 1, 4, 8, 5]
-- [7, 2, 8, 1, 4, 6, 5, 3, 9]


best regards
daniel plaenitz

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to