I have a circle of radius r
and access to a random number generator. What is a method to generate random (x,y)
values distributed along the circle's perimeter?
Generate random points on the perimeter of a circle
2
$\begingroup$
circles
random
-
4Generate a random angle $\theta$ between $0$ and $2\pi$. Take $(x,y)=(r\cos\theta, r\sin\theta)$. – 2012-12-07
1 Answers
7
The simplest method would be to generate a random angle $\theta \in [0,2\pi]$. Then convert from polar to Cartesian with $(x,y) = (r \cos \theta , r \sin \theta)$.
Note that if your random number generator returns a number $k \in [0,1]$ then $\theta = 2\pi k$.