在圆内生成一个随机点(均匀) - Generate a random point within a circle (uniformly)

问题:

I need to generate a uniformly random point within a circle of radius R .我需要在半径为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.我意识到,通过在区间 [0 ... 2π) 中选择一个均匀随机的角度,并在区间 (0 ... R ) 中选择一个均匀随机的半径,我最终会得到更多指向中心的点,因为对于两个给定的半径,较小半径内的点将比较大半径内的点彼此更接近。

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/ R 2r and how he derives the final solution.我想这是正确的,但我真的很想了解他从哪里得到 (2/ R 2r以及他如何得出最终解决方案。


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.更新:发布这个问题 7 年后,我仍然没有收到关于平方根算法背后数学的实际问题的满意答案。 So I spent a day writing an answer myself.所以我花了一天时间自己写一个答案。 Link to my answer .链接到我的答案


解决方案:

参考一: https://en.stackoom.com/question/OUcO
参考二: https://stackoom.com/question/OUcO
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章