Random #'s
Dwayne Rothe
drothe at optusnet.com.au
Fri Jan 28 22:30:58 EST 2005
Hey Guys after analysing the multitude of responses I finally went with the
shortest code!
It works perfect & fast, thats all I needed....
repeat until the number of items in tRnum = 5
set randomSeed to random(10000)
put random(10) into tRand
if tRand is not among the items of tRnum then put tRand & comma after tRnum
end repeat
Thanx to all....... Dwayne
> 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
>
> **********************************************
More information about the use-livecode
mailing list