Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 47 characters in body
Source Link
aioobe
  • 422.6k
  • 115
  • 831
  • 844

I need to generate a uniformly random point within a circle of radius R.

I realize that by just picking a uniformly random angle in the interval [0 ... 2π), and uniformly random radius in the interval (0 ... R) I would end up with more points towards the center, since for two given radii, the points in the smaller radius will be closer to each other than for the points in the larger radius.

I found a blog entry on this over here but I don't understand his reasoning. I suppose it is correct, but I would really like to understand from where he gets (2/R2r and how he derives the final solution.


Update: 7 years after posting this question I still hadn't received a satisfactory answer, so on the actual question regarding the math behind the square root algorithm. So I spent a day writing an answer myself. Link to my answer.

I need to generate a uniformly random point within a circle of radius R.

I realize that by just picking a uniformly random angle in the interval [0 ... 2π), and uniformly random radius in the interval (0 ... R) I would end up with more points towards the center, since for two given radii, the points in the smaller radius will be closer to each other than for the points in the larger radius.

I found a blog entry on this over here but I don't understand his reasoning. I suppose it is correct, but I would really like to understand from where he gets (2/R2r and how he derives the final solution.


Update: 7 years after posting this question I still hadn't received a satisfactory answer, so I spent a day writing an answer myself. Link to my answer.

I need to generate a uniformly random point within a circle of radius R.

I realize that by just picking a uniformly random angle in the interval [0 ... 2π), and uniformly random radius in the interval (0 ... R) I would end up with more points towards the center, since for two given radii, the points in the smaller radius will be closer to each other than for the points in the larger radius.

I found a blog entry on this over here but I don't understand his reasoning. I suppose it is correct, but I would really like to understand from where he gets (2/R2r and how he derives the final solution.


Update: 7 years after posting this question I still hadn't received a satisfactory answer on the actual question regarding the math behind the square root algorithm. So I spent a day writing an answer myself. Link to my answer.

deleted 114 characters in body
Source Link
aioobe
  • 422.6k
  • 115
  • 831
  • 844

I need to generate a uniformly random point within a circle of radius R.

I realize that by just picking a uniformly random angle in the interval [0 ... 2π), and uniformly random radius in the interval (0 ... R) I would end up with more points towards the center, since for two given radii, the points in the smaller radius will be closer to each other than for the points in the larger radius.

I found a blog entry on this over here but I don't understand his reasoning. I suppose it is correct, but I would really like to understand from where he gets (2/R2r and how he derives the final solution.


Regarding rejection samplingUpdate: 7 years after posting this question I could generatestill hadn't received a random point within the R×R square over and over again untilsatisfactory answer, so I get one within the circle. This approach has the obvious draw-back that it doesn't providespent a guarantee for terminationday writing an answer myself. (even though it is highly unlikely that it goes on for long)Link to my answer.

I need to generate a uniformly random point within a circle of radius R.

I realize that by just picking a uniformly random angle in the interval [0 ... 2π), and uniformly random radius in the interval (0 ... R) I would end up with more points towards the center, since for two given radii, the points in the smaller radius will be closer to each other than for the points in the larger radius.

I found a blog entry on this over here but I don't understand his reasoning. I suppose it is correct, but I would really like to understand from where he gets (2/R2r and how he derives the final solution.


Regarding rejection sampling: I could generate a random point within the R×R square over and over again until I get one within the circle. This approach has the obvious draw-back that it doesn't provide a guarantee for termination (even though it is highly unlikely that it goes on for long).

I need to generate a uniformly random point within a circle of radius R.

I realize that by just picking a uniformly random angle in the interval [0 ... 2π), and uniformly random radius in the interval (0 ... R) I would end up with more points towards the center, since for two given radii, the points in the smaller radius will be closer to each other than for the points in the larger radius.

I found a blog entry on this over here but I don't understand his reasoning. I suppose it is correct, but I would really like to understand from where he gets (2/R2r and how he derives the final solution.


Update: 7 years after posting this question I still hadn't received a satisfactory answer, so I spent a day writing an answer myself. Link to my answer.

Question Protected by eyllanesc
deleted 120 characters in body
Source Link
aioobe
  • 422.6k
  • 115
  • 831
  • 844

I need to generate a uniformly random point within a circle of radius R.

I realize that by just picking a uniformly random angle in the interval [0 ... 2π), and uniformly random radius in the interval (0 ... R) I would end up with more points towards the center, since for two given radii, the points in the smaller radius will be closer to each other than for the points in the larger radius.

I found a blog entry on this over here but I don't understand his reasoning. I suppose it is correct, but I would really like to understand from where he gets (2/R2r and how he derives the final solution.


Regarding rejection sampling: I could generate a random point within the R×R square over and over again until I get one within the circle. (If I understand it correctly, this is called "rejection sampling".) This approach has the obvious draw-back that it doesn't provide a guarantee for termination (even though it is highly unlikely that it goes on for long).

I need to generate a uniformly random point within a circle of radius R.

I realize that by just picking a uniformly random angle in the interval [0 ... 2π), and uniformly random radius in the interval (0 ... R) I would end up with more points towards the center, since for two given radii, the points in the smaller radius will be closer to each other than for the points in the larger radius.

I found a blog entry on this over here but I don't understand his reasoning. I suppose it is correct, but I would really like to understand from where he gets (2/R2r and how he derives the final solution.


Regarding rejection sampling: I could generate a random point within the R×R square over and over again until I get one within the circle. (If I understand it correctly, this is called "rejection sampling".) This approach has the obvious draw-back that it doesn't provide a guarantee for termination (even though it is highly unlikely that it goes on for long).

I need to generate a uniformly random point within a circle of radius R.

I realize that by just picking a uniformly random angle in the interval [0 ... 2π), and uniformly random radius in the interval (0 ... R) I would end up with more points towards the center, since for two given radii, the points in the smaller radius will be closer to each other than for the points in the larger radius.

I found a blog entry on this over here but I don't understand his reasoning. I suppose it is correct, but I would really like to understand from where he gets (2/R2r and how he derives the final solution.


Regarding rejection sampling: I could generate a random point within the R×R square over and over again until I get one within the circle. This approach has the obvious draw-back that it doesn't provide a guarantee for termination (even though it is highly unlikely that it goes on for long).

added 24 characters in body
Source Link
aioobe
  • 422.6k
  • 115
  • 831
  • 844
Loading
deleted 14 characters in body
Source Link
aioobe
  • 422.6k
  • 115
  • 831
  • 844
Loading
added 3 characters in body; added 4 characters in body
Source Link
aioobe
  • 422.6k
  • 115
  • 831
  • 844
Loading
added 437 characters in body; added 1 characters in body
Source Link
aioobe
  • 422.6k
  • 115
  • 831
  • 844
Loading
Source Link
aioobe
  • 422.6k
  • 115
  • 831
  • 844
Loading