samedi 20 janvier 2018

Generating random points on the circumference of a circle (python)

I was wondering how can i efficiently get the coordinate of random points on a circular locus. I tried the equation of the circle where (h,k) is the center, r is the radius and (x,k) is the randomly generated point.

(x−h)^2 + (y−k)^2 = r^2

I tried checking each randomly generated point whether it satisfies the equation, but this method is highly inefficient. Is there any way I can implement it in python?




Aucun commentaire:

Enregistrer un commentaire