Hi Dwane,
> 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?
function uniqueRandomNumberList listEntryCount, maxListNumber -- You would pass "5,10"
if listEntryCount < 1 then return empty
put empty into numberList
put empty into returnValue
repeat with x = 1 to maxListNumber
put x&return after numberList
end repeat
repeat
get the random of maxListNumber
put line it of numberList after returnValue
delete line it of numberList
subtract 1 from listEntryCount
if listEntryCount < 1 then return returnValue
put comma after returnValue
subtract 1 from maxListNumber
end repeat
end uniqueRandomNumberList
_______________________________________________ use-revolution mailing list use-revolution@lists.runrev.com http://lists.runrev.com/mailman/listinfo/use-revolution