Generating a random num from a triangular distribution

1k Views Asked by At

http://en.wikipedia.org/wiki/Triangular_distribution#cite_note-1

under "Generating Triangular-distributed random variates" given that U is a number between 0 and 1, what happens if the a, b and c values are greater than 1? Does it change the conditions?

For example, how would the 0 < U < F (F is (c-a)/(b-a)) condition work for a distribution where a = 10, b = 15 and c = 20, and where U was generated as 0.4?

1

There are 1 best solutions below

1
On BEST ANSWER

Let $U$ be a random variable uniformly distributed over $[0,1]$. Also, let $F$ is the pdf of an arbitrary distribution. Denote the inverse of $F$ by $F^{-1}$. In our case $F$ is strictly monotonous over $[a,b]$

The first thing that you have to understand is that the random variable $Y=F^{-1}(U)$ will be distributed according to $F$:

$$F_Y(y)=P(Y<y)=P(F^{-1}(U)<y)=P(U<F(y))=F(y).$$

On Wiki you already found the distribution function of the triangular distribution. $U$ then is plugged in to the inverse of this distribution function, which is defined over $[0,1].$