正方形与圆内的均匀采样
Uniform Sampling in a Square and Circle
题目详情
(a) 如何用两个相互独立的均匀样本 生成一个落在正方形内的均匀点?
(b) 如何用它们生成单位圆内的均匀点?
(c) 只用一个均匀样本能否生成圆内的均匀点?
英文原题
(a) How can you use two independent uniform samples to generate a point uniformly inside a square?
(b) How can you use them to generate a point uniformly inside a unit circle?
(c) Can you generate a point uniformly inside a circle with only one uniform sample?
解析
(a) 直接取点 ,它在单位正方形 上均匀。
(b) 一种常用方法是极坐标变换:取
则 在单位圆盘内均匀。
(也可用拒绝采样:先生成 在 上均匀,若落在圆外则重抽。)
(c) 可以。在理论上,一个 含有无限位随机性,可以把其二进制展开的奇偶位拆成两个独立的 (除去一组测度为 0 的二进制表示不唯一点),从而再用 (b) 的方法生成圆内均匀点。
英文解析
(a) Directly sample a point , which is uniformly distributed on the unit square .
(b) A common method is a polar coordinate transformation: take
Then is uniformly distributed within the unit disk.
(Alternatively, use rejection sampling: generate uniformly on , and resample if it falls outside the circle.)
(c) Yes. In theory, a contains infinite bits of randomness; its binary expansion's even and odd bits can be split into two independent (excluding a set of measure zero of non-unique binary representations), allowing the method in (b) to be used to generate a uniform point inside the circle.