# Generating random angles

**URL:** <https://forum.kirupa.com/t/generating-random-angles/247336>\
**Category:** flash\
**Created:** [December 21, 2007, 12:12pm UTC](https://forum.kirupa.com/t/generating-random-angles/247336 "2007-12-21T12:12:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonnyleeharris](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@jonnyleeharris](https://forum.kirupa.com/u/jonnyleeharris)\
**Post date:** [December 21, 2007, 12:12pm UTC](https://forum.kirupa.com/t/generating-random-angles/247336/1 "2007-12-21T12:12:05Z")

</div>

Imagine this:

You have a variable named currentDir, this is a value in radians, an existing direction of a specific object.

You want to then, from that currentDir, generate a new angle that is in the +/-90 degree range (+/-1.57 radians). How would this be possible? I’m in the middle of writing a function to return this value… but my head is cabbaged, and it’s cold… close to Christmas… you can imagine… 😉

Second question in two days… I hope nobody executes me :P.

Thanks in advance.
