Random but unique

tkuypers at pandora.be tkuypers at pandora.be
Sat Jan 11 14:07:01 EST 2003


I¹m kinda stuck with the following puzzle...

- I¹ve got a variable with x lines where each line has got a unique ID
- I need to get a subset out of this variable of y lines
So i use the random function to get an ID out of the first variable  and put
it into a new variable. This new variable is a separated by returns, just as
the first one.
But to avoid the same ID more than once in this new list, I used a
repeat-loop which first chechs if the new ID isn't allready in the list
before adding it.
To do this I use the "is not in" statement, but when "111" is the new list,
the "is not in" ignores the value "1" and "11" as well...

How can I get an unique but random number from a variable?

Any help is welcome, I can not use a loop to check all lines over and over
again, because it would take to long for bigger lists...

Many thanks in advance,

Ton Kuypers




More information about the use-livecode mailing list