Random #'s

Dar Scott dsc at swcp.com
Fri Jan 28 13:55:19 EST 2005


On Jan 28, 2005, at 11:08 AM, Michael D Mays wrote:

> What does it mean to sort  "1,2,3,4,5"  by 12?
>
> Maybe it should be
>  sort items of x numeric by random(10000)

Yes!  Sorry about that.

I think sort by 12 effectively means to associate 12 with each item and 
then sort by the associated value.  The sort by random(10000) would 
then mean to associate a random value with each item and sort by that.  
The sort by char -1 or each would associate the last char of each item 
with the item and sort by that.

I don't know if it actually implemented that way; it might be the 
sorting expression is evaluated repeatedly with each comparison.  Maybe 
one can run a test with a side effect (say counting) to find out.

Dar

**********************************************
     DSC (Dar Scott Consulting & Dar's Lab)
     http://www.swcp.com/dsc/
     Programming Services and Software
**********************************************



More information about the use-livecode mailing list