# Random angle ranging from value 1 to value2

**URL:** <https://forum.kirupa.com/t/random-angle-ranging-from-value-1-to-value2/323350>\
**Category:** Uncategorized\
**Created:** [June 27, 2011, 12:45am UTC](https://forum.kirupa.com/t/random-angle-ranging-from-value-1-to-value2/323350 "2011-06-27T00:45:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![drpelz](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@drpelz](https://forum.kirupa.com/u/drpelz)\
**Post date:** [June 27, 2011, 12:45am UTC](https://forum.kirupa.com/t/random-angle-ranging-from-value-1-to-value2/323350/1 "2011-06-27T00:45:44Z")

</div>

Hi folks,

there’s this thing that’s driving me nuts.☹

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.😁

```auto

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));

```
