Shuffling is more complicated than commonly thought. A properly uniform shuffle is given as follows:
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 On 2013-05-23, at 4:56 AM, use-livecode-requ...@lists.runrev.com wrote: > Good idea, Jacques. How about this? > > command shuffle @rLines > sort rLines by random( 4294967295 ) -- note: 2^32-1 > end shuffle > > -- Dick > -- Please avoid sending me Word or PowerPoint attachments. See <http://www.gnu.org/philosophy/no-word-attachments.html> -Dr. John R. Vokey _______________________________________________ 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