# Generating a random point in the volume of a finite cylinder

I have a finite cylinder in three-dimensions with a long-axis defined by the endpoints $p_1$ and $p_2$, and radius $R$. What is an easy method of picking a random point in this cylinder with uniform probability across its volume?

-
You can rotate into and out of a new set of coordinates aligned with the axis, but this would most likely be less efficient than sampling and rejection, since the change of coordinates would probably involve 10 or 20 arithmetic operations per sample. Why do you not want to use sampling and rejection? –  Ben Crowell Feb 19 '12 at 21:58
Sampling points on a disk is easily done without rejection, by picking $\theta$ and $r^2$ uniformly in polar coordinates. See this previous answer and MathWorld on disk point picking. –  Rahul Narain Feb 19 '12 at 21:03