# Generate Uniform Random Variates with Constant Norm [duplicate]

How can one generate $$k$$ uniform random variates centered at zero, $$X_1, X_2, ..., X_k$$, given a constant Euclidean norm, $$c =\sqrt{X_1^2+X_2^2+...X_k^2}$$?

• – kjetil b halvorsen Sep 14 '20 at 22:48
• There is no solution --- if they obey the constraint then they are not independent. Perhaps also related to this question. – Ben Sep 15 '20 at 1:46
• @QuestionAsker did you mean that the X's are marginally uniform, or uniform on the hypersurface? – Glen_b Sep 15 '20 at 22:37
• @Glen_b Uniform on the hypersurface. I was under the impression that if they were marginally uniform, they would be be uniform on the surface, but I see now this is not the case. – QuestionAsker Sep 16 '20 at 1:54
• For a sphere, i.e. $k=3$, uniform on the surface does imply marginally uniform (though not independent) - think Archimedes On the Sphere and Cylinder. This is not true in other dimensions. You can then easily construct $X_1,X_2,X_3$ from two independent uniform random variables. – Henry Sep 16 '20 at 7:02

Generate $$k$$ independent standard normal random variates $$Y_1, Y_2, \ldots, Y_k$$
and then scale to give the desired $$c$$ with $$X_i= \frac{c}{\sqrt{Y_1^2+Y_2^2+\cdots+Y_k^2}}Y_i$$
• @Glen_b Whether it's a duplicate depends on how we interpret the "uniform" of the question: does it mean marginally uniform or uniform on the sphere's surface? The question, as currently phrased, strongly implies the former meaning is intended, whereas the duplicate addresses the latter meaning only. The answer is in the negative as one can see by drawing a picture of the case $k=2.$ – whuber Sep 15 '20 at 15:10