How to find the equation of a line inside a circle given the center point of the line? I have a circle with center (0,0) and radius 1. I have calculated a random point inside a circle by generating a random angle $a=random()\cdot 2\pi $ and a random distance smaller than or equal to the radius $b=random()\cdot r$. The center of the line is $(cos(a)\cdot b,sin(a)\cdot b)$. The line has to be inside the circle like this:


Knowing this information how can I calculate the equation of the line in the most efficient way for a computer? Thanks.

The random function generates a random Real Number between 0 and 1.
In polar coordinates,

$$\rho\cos(\theta-a)=b,$$

hence
$$x\cos a+y\sin a=b.$$
you can just do this with basic coordinate geometry. To find the line equation you need the slope and a point. Fortunately, the point is given. You can simply find the slope for the line since the product of two perpendicular lines' slope is -1.