The idea is to consider simultaneously the minimum $Y$ and the maximum $Z$ of the sample. For $y\le z$, the event $[y\le Y,Z\le z]$ is equivalent to the whole sample being between $y$ and $z$, hence, for a sample of size $n$, $P(y\le Y,Z\le z)$ would be $P(y\le X\le z)^n$. Here one considers a sample of random size $N$, hence $ P(y\le Y,Z\le z)=\sum_{n\ge1}P(N=n)P(y\le X\le z)^n=c(\mathrm{e}^{P(y\le X\le z)}-1), $ with $ c=1/(\mathrm{e}-1). $ To get the joint distribution of $(Y,Z)$, one should differentiate $P(y\le Y,Z\le z)$ twice, with respect to $y$ and $z$, yielding $ P(Y\in\mathrm{d}y,Z\in\mathrm{d}z)=c\mathrm{e}^{P(y\le X\le z)}P(X\in\mathrm{d}y)P(X\in\mathrm{d}z). $ To get the distribution of $Y$ alone is even simpler, one differentiates $P(y\le Y,Z\le z)$ once with respect to $y$ and one lets $z\to+\infty$, hence $ P(Y\in\mathrm{d}y)=c\mathrm{e}^{P(X\ge y)}P(X\in\mathrm{d}y). $ Likewise, to get the distribution of $Z$ alone, one differentiates $P(y\le Y,Z\le z)$ once with respect to $z$ and one lets $y\to-\infty$, hence $ P(Z\in\mathrm{d}z)=c\mathrm{e}^{P(X\le z)}P(X\in\mathrm{d}z). $ In the special case where the sample is uniform on $(0,\theta)$, for $0\le y\le z\le\theta$, the density of the distribution of $(Y,Z)$ at $(y,z)$ is $ f_{Y,Z}(y,z)=(c/\theta^{2})\mathrm{e}^{(z-y)/\theta}. $ Finally, the densities of the distributions of $Y$ and $Z$ on $(0,\theta)$ are $ f_Y(y)=(c\mathrm{e}/\theta)\mathrm{e}^{-y/\theta}, \quad f_Z(z)=(c/\theta)\mathrm{e}^{z/\theta}. $