Re: Setting a list to a random order
Re: Setting a list to a random order
- Subject: Re: Setting a list to a random order
- From: has <email@hidden>
- Date: Mon, 23 May 2005 23:51:27 +0100
Mark J. Reed wrote:
>Sure. The Fisher-Yates Shuffle will randomize a list in place, with no need to make a copy:
If the list is large, there's a well optimised version of this routine in AppleMods' List library <http://applemods.sourceforge.net/mods/Data/List.php> that'll rapidly chew through it. Example:
-- [auto-generated library loading code omitted for clarity]
_List's unsortList({1, 2, 3, 4, 5, 6, 7, 8, 9, 10})
--> {7, 3, 9, 2, 1, 5, 10, 6, 4, 8}
If you've not used AppleMods' libraries before, you'll need to download and install AppleMods' Loader system first <http://applemods.sourceforge.net/getstarted.html>. Run the Loader installer, then download and add the List library to the ASLibraries folder. You can use the LoaderWizard applet to generate the library loading code to paste at the top of your script.
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden