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.

Be the first one to answer
Add answer anonymously...
Trilogy Innovations Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter