This works fine, but it goes 1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9, etc. I need it to go anything like: 2,4,3,2,2,3,4,6,7,8,5,6,7,8,8,5,4,3,5,6,10,8. The numbers must just come up randomally. Possible? Please?
Better to use either of the following, which deliver 1-10 with even distribution:
a) Math.floor(Math.random()*10)+1
b) random(10)+1
a and b are exactly the same, but b is more readable. b is "deprecated" however I use it all the time, and I seriously doubt it will ever go away - it's just too darn convenient.
A lot of folks on this board will tell you to use this one:
c) Math.ceil(Math.random()*10)
It seems simpler because it doesn't have a "+1" and if you test it, it will appear to have identical results to methods a and b.
HOWEVER, it actually has a VERY slight chance (something like 1 in a billion) of producing zero as well (because Math.random() may return zero, and Math.ceil(0) is zero.
Finally, if you are using random numbers and arrays a lot, you will find it easier to name your movieclips starting from 0, rather than starting from 1. This way you can just use this:
d) random(10)
and it will refer to objects 0 thru 9 with even distribution.
... Ca you put in the whole code and explain every part of it because I am only 14 and I don't know what your talkin about and I don't see a random number generator code in what you just gave me.
if you wanted to test for different values and then send the movie to a different frames you could do something like this,
Code:
if (myVar == 1) {
gotoAndPlay(3);
} else if (myVar == 2) {
gotoAndPlay(5);
} else {
gotoAndPlay("wherever"); // or don't do anything if it should only goto a frame for certain values
}