# How to simulate the exponential law over an interval of the form [0,T]?

How do you simulate an exponential random variable over an interval $[0, T]$ with $T > 0$?

• Do you know mathematics stack exchange ? – MJ73550 Dec 17 '16 at 21:24

Let $X$ be an exponential r.v. of parameter $\lambda$ $$P (X<u|X <T)=\frac {P (X<min (u,T))}{P (X <T )}$$ So for $0\leq u\leq T$ $$P (X<u|X <T)=\frac {1-\exp (-\lambda u)}{1-\exp (-\lambda T)}$$
So if $U$ is an uniform on $[0,1]$ then $$Y= -\frac {1}{\lambda }\ln\left (1-U (1-\exp(-\lambda T))\right)$$ is an exponential r.v. of parameter $\lambda$ conditionned to be on $[0,T]$