On May 23, 2013, at 1:52 PM, Björnke von Gierke wrote:
> So we do need the sort to actually be "for each", instead of random.

That will work if what we are looking at is random as far as we can tell.  For 
example, by  md5Digest( each ) might scramble in a sense, but it would be the 
same each time.  Or something like this could be done.

AssignUniqueRandomNumToEachLine myVar
sort lines of myVar by assignedUniqueRandomNum( each )
RemoveUniqueRandomNumFromEachLine myVar

> Would you guys say this is a bug, or that a feature request for making sort 
> use a unique random value instead of an arbitrary one?

I would not be surprised if I have made this mistake.  So, the bug is in me.  
However, since this is a common pitfall, and this is the kind of thing 
beginners want to do, I think we need some example or even a language feature 
to help.  

I think your comments about some big number or magic numbers might apply.  That 
is even more reason to have a language feature help.

I'm not sure that a function that returns a list of unique random numbers 
(whatever that means) will help.  (I'm not saying that is what you are 
suggesting.)  

A machine that can be set to return a range of numbers in random order might be 
handy.  That might be what we are thinking when we use random() at times.  We 
can create that now and use the function in sort...by....

This can be done in LiveCode:

command resetUniqueRandom
function uniqueRandom pRange

The function can be used where random() is used now.  The issue of what to do 
when there are none available needs to be addressed.  

Dar

_______________________________________________
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

Reply via email to