Hi guys, i recently started working with Director and Lingo and also come from a programming background...
My problem is this, I need to generate 6 random numbers and store them each in a variable num1...num6 the number range for the random function will be from 1 to 49.
what I want to do is for each variable such as num1 I want to assign it a custom made function:
num1 = generateRandom()
which then fires the custom random function that I will make
function generateRandom() {
// generate random digit
// check if it is the same as num2,num3,num4,num5,num6
if it is, then regenerate number and test again..
// return random digit
}
I've written the code similar to javascript as its the only way I can clearly explain what I am trying to achieve, I seem to be struggling to implement such a thing in Director, can we give a variable the assignment of a function?? can I create a function like the one above?
if you have any example code I would be greatful, thanks a lot!!
My problem is this, I need to generate 6 random numbers and store them each in a variable num1...num6 the number range for the random function will be from 1 to 49.
what I want to do is for each variable such as num1 I want to assign it a custom made function:
num1 = generateRandom()
which then fires the custom random function that I will make
function generateRandom() {
// generate random digit
// check if it is the same as num2,num3,num4,num5,num6
if it is, then regenerate number and test again..
// return random digit
}
I've written the code similar to javascript as its the only way I can clearly explain what I am trying to achieve, I seem to be struggling to implement such a thing in Director, can we give a variable the assignment of a function?? can I create a function like the one above?
if you have any example code I would be greatful, thanks a lot!!