Re: What is the quickest way to randomize a list?
Re: What is the quickest way to randomize a list?
- Subject: Re: What is the quickest way to randomize a list?
- From: "Arthur J Knapp" <email@hidden>
- Date: Tue, 10 Apr 2001 20:55:43 -0400
>
Date: Tue, 10 Apr 2001 23:47:13 +1000
>
Subject: Re: What is the quickest way to randomize a list?
>
From: Timothy Bates <email@hidden>
>
Comparing using Akua to synch the list to a randomised list, Chris Nebel's,
>
2-step replace and random number requestor, and Arthur's 1-step shuffle and
>
in-line random request, the results are In the ratio of 5:4:2 where smaller
>
is faster, so .... Arthur wins by a country mile!
Is that more or less than a city block?
;-)
>
on ajk_unsort_02(lst)
>
set {s1,s2,len} to {random number from 1 to 100000, 31415, lst's length}
>
repeat with i from 1 to len
>
set {j, s1} to {(s1 mod len) + 1, (s1 * s2) mod len}
>
set {lst's item i, lst's item j} to {lst's item j, lst's item i}
>
end repeat
>
end unsort
I wouldn't put too much stock into this handler without really testing
it some more.
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.mainevent.com