Random Point Generator in a Circle
Mr. Schrodinger needs to generate points that are uniformly distributed inside a specific circle for testing his hypothesis. Your task is to implement a function that generates random points evenly distributed within the given circle.
Example:
Input:
The first line contains an integer 'T' which indicates the number of test cases.
Each test case consists of one line containing three space-separated integers 'X', 'Y', 'R' denoting the coordinates of the circle's center and its radius.
Output:
For each test case, return 1 if the points are correctly uniformly distributed, otherwise 0.
Constraints:
1 ≤ T ≤ 5
-10^9 ≤ X, Y ≤ 10^9
1 ≤ R ≤ 10^9
Note: A point on the circle's circumference is considered inside the circle. You do not need to handle input or output; those aspects are managed for you. Focus on implementing the function.
AnswerBot
8d
Implement a function to generate random points uniformly distributed inside a circle.
Generate random points using polar coordinates
Ensure points fall within the circle by checking if distance from cen...read more
Help your peers!
Add answer anonymously...
Top Trilogy Innovations Software Developer Intern interview questions & answers
Popular interview questions of Software Developer Intern
>
Trilogy Innovations Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app