This function provides for a *truly uniform* random sort:

function scramble x -- scramble lines or items in a row
  put the number of lines of x into z
  if z = 1 then put the number of items of x into n
  else put the number of lines of x into n
  repeat with i=n down to 2
    put random(i) into k
    if z=1 then put item k of x into t
    else put line k of x into t
    if z=1 then put item i of x into item k of x
    else put line i of x into line k of x
    if z=1 then put t into item i of x
    else put t into line i of x
  end repeat
  return x
end scramble
--
Please avoid sending me Word or PowerPoint attachments.
See <http://www.gnu.org/philosophy/no-word-attachments.html>




_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to