# Random number generation distributed like a translated weibull from uniform random generator

If $X$ is uniformly distributed on $(0,1)$, then the random variable $\lambda(-\ln(1-X))^{1/k}\$, is Weibull distributed with parameters $k$ and $\lambda$.

With this, I can get random numbers distributed weibull from a uniform random number generator.

but if I have a translated Weibull distribution

$f(x, k, \lambda, \theta) = \frac{k}{\lambda} (\frac{x-\theta}{\lambda})^{k-1} \exp^{-(\frac{x-\theta}{\lambda})^k}$

how is the transformation to generate random numbers distributed like a translated weibull from a generator of uniform random numbers ?

### EDIT

the question it's not about the density function, it about of the transformation. How I can generate random numbers distributed like a translated weibull ? (using a uniform random number generator)

• It seems that you are saying you know how to generate values of $X-\theta$ and you wish to have a set of values of $X$ instead. In other words, given any realization $x_i-\theta$ you need a formula for $x_i$ in terms of $x_i-\theta$ and $\theta$. Is this correct?
– whuber
Feb 18 '14 at 19:06
• @whuber I can generate random numbers with an uniform distribution, and with the transformation ($\lambda(-\ln(1-X))^{1/k}\$) exposed in the question, therefore I can change the distribution of the numbers to a Weibull distribution ( $[0, \inf)$). how I can change the distribution of the randon numbers uniformely distributed to random numbers distributed like a translated weibull distribution ( $[\theta, \inf)$ ). Feb 18 '14 at 19:50
• Have you noticed that to convert $x-\theta$ to $x$ you only need to add $\theta$?
– whuber
Feb 18 '14 at 19:52
• @whuber , the question it's not about the density function, it about of the transformation. How I can generate random numbers distributed like a translated weibull ? (using a uniform random number generator). Feb 18 '14 at 20:01
• To expand on @whuber's comment / answer, let $y = x - \theta$. $y$ then has a standard Weibull distribution; you can see this by substituting $y$ for $x-\theta$ in your formula for $f(\dots)$. You can generate $y$ as you describe above, then get back to $x$ by adding $\theta$. Feb 18 '14 at 20:11

If $T$ is your translated Weibull, then you can generate variates $t_i$ from the translated Weibull with the following: $$t_i = \theta + \lambda(-\ln(1-x_i))^{1/k}\ ,$$ where the $x_i$ are your uniform random numbers.