I am trying to create a lottery program for my advanced higher computing projecting livecode, it generates 6 random numbers from 1 to 49 then gives the user 2 chocies to choose his own numbers or have the computer generate numbers for him. I have it all well and working apart from 2 problems. Firstly it has repeating numbers sometimes, I have tried using another array of possible numbers it choosing a random number from that then deleteing that number the code for it is as follows
Code: Select all
on Generate_users_numbers
local usersnumbers, possiblenumbers, numberoflines, arrayfile, arraypossiblenumbers
put url ("file:" & "C:/Users/Pincer/Desktop/Computing/Project/a.txt") into possiblenumbers
put the number of lines in possiblenumbers into numberoflines
repeat with loop = 1 to numberoflines
put line loop of possiblenumbers into arrayfile[loop]
end repeat
repeat with loop = 1 to 7
put random(49) into arraypossiblenumbers
put arrayfile[arraypossiblenumbers] into usersnumbers
repeat until usersnumbers is not empty then
put random(49) into arraypossiblenumbers
put arrayfile[arraypossiblenumbers] into usersnumbers
end repeat
put usersnumbers into array_users_numbers[loop]
delete variable arrayfile[arrayposiblenumbers]
end repeat
end Generate_users_numbers
Please can someone help me.