Generate random points on 10-dimensional unit sphere

前端 未结 2 1363
天涯浪人
天涯浪人 2021-01-15 03:23

I need to generate a vector sampled uniformly with 10 directions (a collection of 10 random numbers) which lies over a unit sphere. So, the sum of the squares of the 10 valu

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-15 04:17

    There is a math theorem saying that if X = (X1,...,XN) is a vector with Xi the standard normal distribution, then X/NORM(X) is uniform in the unit sphere, where NORM is the euclidean norm. So you have to sample 10 points from a standard normal distribution (using numpy?) and then normalize the result.

提交回复
热议问题