randomly order a list

Dar Scott dsc at swcp.com
Wed May 22 17:03:48 EDT 2013


I think you are going to get the first line of the original list (correct answer) about half the time.  Does that seem right to you from what you have seen?  The correct answer will be in the first two about 80% of the time.  

Using the larger argument for random should give you better proportions.  You should get it in the first line a third of the time.  

If you only interested in the first line, there might be some methods that are clearer and more fun.

Dar


On May 22, 2013, at 11:59 AM, Chris Sheffield wrote:

> 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?
> 
> Thanks,
> Chris
> 
> 
> --
> Chris Sheffield
> Read Naturally, Inc.
> www.readnaturally.com
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list