Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have n dimensional space. Let us say n=20 for your case. And I also have a point p1 in that space.

What I want to do is get a random point (newpoint) in that space such that distance(p1, newpoint)<=r, where r represents radius that I already know.

Thank you. Any feedback will be greatly appreciated.

share|improve this question
Assuming you want a uniform distribution within the ball of radius $r$, Nate Eldredge's answer here for the 3D case generalizes nicely to $n$ dimensions. Also, MathWorld has a page on ball point picking that gives a rather striking alternative approach. –  Rahul Oct 25 '12 at 9:52
Thank you! It is not as bad as I thought it would be! –  nth Oct 25 '12 at 10:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.