I want to generate random numbers between 1 to 10. I have
successfully written script for that. Now, the problem is bcuz it
is random it might generate the same number again. I want to
eliminate that. I have a vague idea that I will have to store each
generated number in an array (using push method) and then every
time a number is generated, will have to ask flash if the same
exists as an element of the array. If it does, skip and generate
again. This way it should generate only 10 numbers, all different,
and then stop.
However, m not able to put this through. Any help would be
This, or variations on this, is fairly popular question. A
good approach is to fill an array with the values you want, then to
shuffle the array, and finally to just take them out of the array
one by one. That way you will have all the values without repeats.
There are several different shuffle functions/prototypes out
there. I like the one I have posted a bit down this thread.