# Finding a circumference point?

Hello. If I define a radius length and use the Vector3 of the game object as the circle’s center, how can I find a random point on a circumference? Then, how can I store that point as a Vector3 (in world space)? Thanks

If you use the object’s z-axis as the centre of the circle, you can use

``````float angle = Random.Range(0, 360);
Vector3 worldPos = transform.TransformPoint(randomCircle * radius);
``````

Well, if you made a circle in 2d then when looking at the circle you want a random point somewhere on the circle given some value of the radius.
If I understand correctly,

The formula that can define a circle is x^2+y^2=r^2, where x and y are points and r is the radius.

We can rearrange this for y which would be
Y=sqrt(r^2-x^2)
This is a function and is only give the top part of the circle, since you already know what r is because you are predefining it all we need to do now is pick a random x value which will be between -r to r
Then we put this into the formula above and we will get the corresponding y value. This alone will give you a random point on the top part of the circle.

In order to make it random else where you need to make the calculated y value to be positive or negative randomly.

Let’s make a variable that will hold the value that will determine if it is positive or negative. Call it yrandom
Yrandom= random.range(0,2)
If(yrandom==0)
{
Yvalue=-yvalue;
}
This will make the yvalue negative fifty present of the time. Thus giving you a random position on the circle.

I know this is complicated so I will try and make the code here.

Var y:float ;
Var x: float;
Var yrandom: float;