How to uniformly sample multiple numbers whose product is within some bound Suppose I have 3 positive integers: $n_1$, $n_2$, and $n_3$.
How do I uniformly sample $(n_1, n_2, n_3)$ so that $50 < n_1 n_2 n_3 < 100$.
I could sample each number independently with bounds between 1 and 100, then keep re-sampling if their product is out of bound.
I need to do this with a computer program with more numbers and larger bounds, so I prefer a way that's efficient both in space and time.
Are there other ways to sample than what I described above?
EDIT (regarding the accepted answer):
At the time of this edit, there were 3 approaches answered so far:

*

*complete enumeration (addresses the example in the question, simple, but space and time bound for very large problems)

*rejection sampling (simple, but time bound for very large problems)

*weighted draw ("efficient" in space and time compared to other approaches, but complex)

All answers work best in different situations.
I accepted weighted drawing since it seemed to be most complete in a sense that it addressed the "efficient both in space and time" part for larger problems the best.

There are only 871 such tuples of positive integers $x,y,z$ that $50<xyz<100$.
I believe you can precalculate them and select randomly from the list.
