On Thu, May 23, 2013 at 1:08 AM, Dar Scott <d...@swcp.com> wrote: > The problem is equality in the sort. It keeps the same order in > comparison of pairs of items. For example, the items sorted in the last > case above as though they were 2,2,3. The first item is still first. > > So... > > Use large values for the argument to random() in random sorts. >
Came here to say this -- in case it's not clear, sorts in LC are stable, meaning that they don't change the order of the input unless they have to. This can be useful when you have several different things to sort by. Suppose you want to sort a list of people by age, and then by name. If the data looks like first name,last name,age,other stuff then you could use: sort lines of theData by item 1 of each sort lines of theData by item 2 of each sort lines of theData numeric by item 3 of each To Dar's point, here the stable sort means that you should never use this to get a random sort: sort lines of someContainer by random(the number of lines of someContainer) You are almost guaranteed to get less than random results. Instead always use something like sort lines of someContainer by random(999999999) gc _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode