How to generate random points in a circular distribution

前端 未结 6 1691
执笔经年
执笔经年 2021-02-02 17:54

I am wondering how i could generate random numbers that appear in a circular distribution.

I am able to generate random points in a rectangular distribution such that

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 18:24

    You can use rejection sampling, generate a random point within the (2r)×(2r) square that covers the circle, repeat until get one point within the circle.

提交回复
热议问题