Alternate Random Sort?

Scott Rossi scott at tactilemedia.com
Fri Jul 14 15:20:18 EDT 2006


Greetings List:

I have a list of 14,000 numbers that consists of only 1's and 2's:
1
1
1
2
2
2
2

I want to randomize the list.  When I use:

  sort lines of mySet by random(the number of lines of mySet)

...the time needed is too slow (takes about 7 seconds to execute here).  Is
there a faster way to randomize the list?  (the numbers could also be stored
by item if that would help: 1,1,1,1,2,2,2,2,2)

Here's a sample script:

on mouseUp
  repeat 6000
    put 1 & cr after temp
  end repeat
  repeat 8000
    put 2 & cr after temp
  end repeat
  delete last char of temp
  put the millisecs into MS
  sort lines of temp by random(the number of lines of temp)
  put the millisecs - MS
end mouseUp

Thanks & Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com





More information about the use-livecode mailing list