Random angle ranging from value 1 to value2

Hi folks,

there’s this thing that’s driving me nuts.:frowning:

I want a random angle ranging from - let’s say - 10 to 80 (degrees). I got some code but there seems to be a bug inside of it. It calculates a random number (working) between 10 and 80. But when I paste it into the other variable (astAngle1) it’s generating a random value not higher than 56(???). Please help me. Currently I can’t find a real solution. Thank you very very much.:grin:


var randomNumber:Number = ((Math.random() * (80 - 10) + 1) + 10);

trace(Math.round(randomNumber));

var astAngle1:Number = Math.cos(((Math.PI) * randomNumber / 180.0));
trace(astAngle1);

var degrees2:Number = astAngle1 * 180 / Math.PI;

trace(Math.round(degrees2));