java - How to generate some identically distributed pseudo-random vectors with a fixed length r in a programming language? -
for example, dimension d=2, means generate random angle 0<=a<2*pi, , use
(x_1,x_2)=(r*cos(a),r*sin(a)) random vector.
however, dimension d>=3, not generate angle , use represent vector. how generate such vector (x_1,...,x_d), identically distributed on x_1^2+x_2^2+...+x_d^2=r^2?
i have come new idea, generate vector (x_1,...,x_d) such -r<=x_i<r i, normalize if x_1^2+x_2^2+...+x_d^2<=r^2 , abondon if x_1^2+x_2^2+...+x_d^2>r^2. 
however, there drawback probability x_1^2+x_2^2+...+x_d^2<=r^2 become small if d large. there exist better solutions?
generate random variables (x_1, x_2, ... x_d) independent , have standard normal distributions, , normalize dividing sqrt(x_1^2+...+x_d^2)/r.
that joint distribution of independent normal distributions rotationally symmetric not true, characterizes normal distributions.
you can generate pairs of independent variables standard normal distribution efficiently uniform random variables using box-muller transform.
Comments
Post a Comment