There is insideUnitCircle Returns a random point inside a circle with radius 1 (Read Only). insideUnitSphere Returns a random point inside a sphere with radius 1 (Read Only). onUnitSphere Returns a random point on the surface of a sphere with radius 1 (Read Only). what happened to OnUnitCircle? Did someone just forget to put it in?
... float force = 600.0f; float angle = Random.Range(0, 2f * Mathf.PI); float x = Mathf.Cos(angle) * force; float y = Mathf.Sin(angle) * force;
I've learned things since 2015 A better OnUnitCircle is just: Code (csharp): var angle = Random.value * 2 * Mathf.PI; return new Vector2(Mathf.Sin(angle), Mathf.Cos(angle)); I assume that the way InsideUnitCircle is made is just that, but multiplied by Random.value. Also OP hinted at that being the solution, and I was just too daft to catch it 6 years ago? idk, it's been a while.
As a sidenote, you actually have to multiply by Mathf.Sqrt(Random.value) to get evenly distributed positions. Rejection sampling (pick random values unless get position inside circle) is bit faster on average but they probably don't use it because it will not be that stable in terms of performance.