dan at clearvisiontech.com
Thu Jan 27 11:50:47 EST 2005
I'm sure there's a better way to do it, but how about this...
function makeRandomNumberList maxNumber
put 0 into i
put random(10) into thisNum
if thisNum is among the items of fNumbers then
add 1 to i
put thisNum into item i of fNumbers
if i = 6 then
> Hi All,
> I am using the following code to generate a field of 6 random numbers.
> repeat 5 times --generate list of 5 random numbers between 1-10
> put random(10) & "," after tRnum
> end repeat
> delete last char of tRnum --delete last comma
> put tRnum into fld "numbers"
> this works fine but some numbers are repeated in the field, e.g (1,2,3,1,5)
> How can I include only unique numbers?
More information about the Use-livecode