Solution (source code)

= Solution

For $\alpha,\beta>0$, integrating the <Weibull distribution> <probability density function> gives
$$
G(x)=1-e^{-x^\alpha/\beta}\quad(x\geq0).
$$
The <inverse transform sampling> method takes $U$ uniform on $(0,1)$ and solves $G(X)=U$. Hence
$$
\boxed{X=\{-\beta\log(1-U)\}^{1/\alpha}.}
$$
Since $1-U$ is also uniform, $\{-\beta\log U\}^{1/\alpha}$ is an equivalent implementation. For any $x\geq0$, the resulting event $X\leq x$ has <probability> $G(x)$, verifying its distribution.