4 ms·
Rejection sampling is not necessarily a bad idea in general, but in this particular case it would be bad. You are going to choose 300 random numbers between -1
by asafira 10y ago
Rejection sampling is not necessarily a bad idea in general, but in this particular case it would be bad.
You are going to choose 300 random numbers between -1 and 1, and then throw away this batch if their norm is greater than 1. As you increase dimension (in this case 300), you are including more numbers that give a non-negative contribution to this norm, and so you are increasing your chance of rejection with each dimension.
Re-reading your comment, I notice you made a higher-level note regarding the volume of the hypercube vs. hypersphere. While my comment was right, I now think you are right that the volume ratio of hyper sphere to hypercube is, in fact, always over 0.5. I'm gonna run a quick simulation anyway, but you can convince yourself of this by considering that the line segment connecting (1,0) and (0,1) in 2D lies within the unit circle, but a similar construction will always work for high dimensions (I think).