如何随机选择的地球表面上的点?表面上、地球

2023-09-11 04:16:12 作者:听雨在轻吟

正如标题所说,如何将随机选择一个坐标在地球表面上不带偏见?做兰特(-90,90),兰特(-180,180)的简单的解决方案将有利于极地地区在赤道地区。

As the title says, how to randomly select a coordinate on the surface of the Earth without bias? The simple solution of doing rand(-90,90),rand(-180,180) will favor polar regions over equatorial regions.

推荐答案

这听起来像你正在寻找一个的均匀随机分布在一个球体。

It sounds like you're looking for a uniform random distribution on a sphere.

在球面坐标:

θ = 2π * rand(0,1)
Φ = arccos(1 - 2*rand(0,1))