Random but unique

Jim Hurley jhurley at infostations.com
Mon Jan 13 13:36:01 EST 2003


>
>Sarah wrote:
>It seems to me that everyone is being too complicated. What about:
>
>sort lines of vChooseFrom by random(10000)  -- or some suitably big
>number
>return line 1 to vNumToChoose of vChooseFrom
>

I see how this works, and it is deliciously simple, but I don't see 
why. According to the documentation:

"The shortKey is a chunk expression that specifies which part of each 
line is used as the sort key. "

How does random(10000) specify "which part of each line is used" and 
why does that give the desired result?  I am mystified.

When the compiler see "random(....)" does it bypass the "which part 
of each line is used" and just use the random() as seed in a random 
number generator to randomize the lines? Puzzling!

Jim Hurley



More information about the use-livecode mailing list