Generate Random Point in a Circle LeetCode solution in Python
1class Solution:23def __init__(self, radius: float, x_center: float, y_center: float):4self.rad = radius5self.xc = x_center6self.yc = y_center78def randPoint(self) -> List[float]:9while True:10xg = self.xc + random.uniform(-1, 1) * self.rad * 211yg = self.yc + random.uniform(-1, 1) * self.rad * 212if (xg - self.xc) ** 2 + (yg - self.yc) ** 2 <= self.rad**2:13return [xg, yg]141516# Your Solution object will be instantiated and called as such:17# obj = Solution(radius, x_center, y_center)18# param_1 = obj.randPoint()