# 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

## 1 Answer

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$$

• probably a duplicate but faster to type an answer than find it - stats.stackexchange.com/questions/7977/… deals with the 3D case and lots of questions are linked to it – Henry Sep 14 '20 at 22:44
• Per Ben's comment, this fails to meet the condition that the X's are independent. If the OP removes that condition so that your answer applies, then the question is definitely a duplicate as indicated. – Glen_b Sep 15 '20 at 3:09
• @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
• @Glen_b it has been changed to remove "independent" – Henry Sep 15 '20 at 15:28
• @whuber given that the OP has now clarified in comments, it should instead close as a duplicate though I doubt we'd gather the votes to both reopen and close again for a new reason. – Glen_b Sep 16 '20 at 2:20