Having worked in Director using Lingo, I am wondering if Flash has a RandomSeed equivalent in ActionScript?
For those of you not familiar with RandomSeed, it is the number that allows the computer to come up with ‘random’ numbers. By setting this number you can then get predictable results everytime. It can be very useful.
Thanks
chris
[AS]myNumber = Math.round(Math.random()*6); // random integer from 0 to 6[/AS]
thanks, BlueNar, but I should have been much more descriptive in my request. You are demonstrating the Math.random() function, which i am well aware of. I am looking for a randomSeed() ‘like’ function.
I will give more detail.
In Lingo (for Director), you have a function called RandomSeed. Really I guess it is a variable that is the root number that the computer uses to get its random numbers.
If you set this variable to a specific number, the sequence of random numbers generated afterwards will always be the same. So for example we have the following code:
randomseed = 1234567;
while (i<10) {
trace( [COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]round[/COLOR]COLOR=#000000 [/COLOR]);
i += 1;
}
Output might be: 5,2,4,1,6,6,2,5,4.
Run it again, and the output would be EXACTLY the same everytime. Unless of course you change or remove the randomseed.
There is nothing like that in Flash at this time.