在圓內生成一個隨機點(均勻) - 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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章