# Random Unit Vector In 2 Directions

**URL:** <https://forums.unrealengine.com/t/random-unit-vector-in-2-directions/682918>\
**Category:** C++\
**Tags:** unreal-engine, UE5-0, Blueprint, question, CPP, vector-math\
**Created:** [November 3, 2022, 12:33am UTC](https://forums.unrealengine.com/t/random-unit-vector-in-2-directions/682918 "2022-11-03T00:33:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![markcham](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@markcham](https://forums.unrealengine.com/u/markcham)\
**Post date:** [November 3, 2022, 12:33am UTC](https://forums.unrealengine.com/t/random-unit-vector-in-2-directions/682918/1 "2022-11-03T00:33:15Z")

</div>

I have a relatively simple question, but I’m really rusty on vector math. I have a starting location (vector). I want to spawn something a fixed length away from the location, along only the YZ plane.

If it could be in 3 directions, Random Unit Vector would work just fine.

Another way to think about this is that I want to spawn something randomly along the edge of a 2d circle.

 ![Untitled](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/b/2/ab2d86cdc5f6042f07eaa58c90db21697493c19e.png)

Thanks,  
Mark

---

<div class="post-metadata">

**Author:** ![markcham](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@markcham](https://forums.unrealengine.com/u/markcham)\
**Post date:** [November 3, 2022, 12:39am UTC](https://forums.unrealengine.com/t/random-unit-vector-in-2-directions/682918/2 "2022-11-03T00:39:48Z")

</div>

Figures that I would find the solution minutes after posting this, but this seems to work. Not sure if its diminishing the randomness or not though.

 ![a72de0ffad3ca0bfadd7f1ae178890e5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/f/e/5fed4ab824723b2197513e8adcfc613511fa27ef.png)
