How do I program a random value of either 1 or -1?
In in my case actionscript or any other programming language, you might want to code a random value to be either 1 or -1, for example to randomly have an object rotate clockwise or counter-clockwise. This is how you can get this value in actionscript:
var randomDirection:Number = Math.round(Math.random())*2-1;
Now the randomDirection variable will always be either 1 or -1.