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
As @Andrex suggested, here is the right solution:
import numpy as np import math s = np.random.normal(0, 1, 10) norm=math.sqrt(sum(s*s)) result=s/norm
where result is the answer. You can evaluate the result:
result
sum([x*x for x in result]) 1.0