randomly order a list

dunbarx at aol.com dunbarx at aol.com
Wed May 22 14:24:35 EDT 2013


With only three lines, are you sure you are not just seeing possible similar consecutive sorts, since there are not that many options? Try hitting the sort button again. It should work out as advertised.

But with only three, the possibility of keeping the same order, or having one stay in place, is high. If you cannot provide more than three options, maybe it is best to invoke a string of "random" sorts:



and choose one of these at random, or maybe just run through that list, ordering your answers according to the order of the next line in the list.

Craig Newman

-----Original Message-----
From: Chris Sheffield <cmsheffield at icloud.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Wed, May 22, 2013 2:01 pm
Subject: randomly order a list

I have a list of three words that I need to be randomly sorted. To start with, 
the first word is the correct answer to a question. I want to re-order the list 
so that the correct answer may be the second or third word, and not necessarily 
the first. How can I do this successfully every time? The docs give an example 
like this:

	sort lines of myVar by random(the number of lines of myVar)

But this only seems to work successfully one time. After that, the list is 
always set so the first word is the correct answer. So then I tried randomly 
setting the randomSeed value, since this value is supposed to affect the 
random() function and the any keyword, but this didn't seem to make much 
difference except to change it so either the second or third word is *always* 
the right answer. I need it to be more mixed up than that.

So does anyone have a good way to do this?


Chris Sheffield
Read Naturally, Inc.

use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 


More information about the use-livecode mailing list