(Second, better answer.) Instead of using acceptance-rejection (as described in my original answer below), it would be even easier just to take $\{Y\}$, the fractional part of $Y$, where $Y$ is exponential$(\lambda)$. I can't find an online proof of it, but it is true that if $Y$ is exponential$(\lambda)$ then $\{Y\}$ has the truncated exponential$(\lambda)$ distribution on $[0,1]$, which is exactly what you're looking for. (And as I mention below, it's easy to generate exponential random variables: If $X \sim U(0,1)$, and $Y = -\ln(x)/\lambda$, then $Y$ is exponential$(\lambda)$.)
The proof that $\{Y\}$ has the truncated exponential distribution on $[0,1]$ is not that bad. You find the joint distribution $P(\lfloor Y \rfloor = k, \{Y\} \leq x)$ and then use that to find the distributions of $\lfloor Y \rfloor$ and $\{Y\}$. The distribution of $\lfloor Y \rfloor$ turns out to be geometric, that of $\{Y\}$ is the truncated exponential, and $\lfloor Y \rfloor$ and $\{Y\}$ are independent. A reference is Bennett Eisenberg, "On the expectation of the maximum of IID geometric random variables," Statistics and Probability Letters, 2008.
(Original answer.) Actually, the exponential distribution is one of the few distributions you can invert analytically when using the inverse transform sampling method.
The pdf of the exponential distribution is $f(x) = \lambda e^{-\lambda x}$, $x \geq 0$. Thus the cdf is $F(x) = \int_0^x \lambda e^{-\lambda t} dt = 1 - e^{-\lambda x}$. Inverting this by solving for $x$ we have $F(x) - 1 = - e^{-\lambda x} $ $\Rightarrow -\lambda x = \ln (1- F(x))$ $\Rightarrow F^{-1}(x) = -\ln(1-x)/\lambda$. Thus if $X$ is an observation from a $U(0,1)$ distribution, then $Y = -\ln(1-X)/\lambda$ is an observation from an exponential$(\lambda)$ distribution. Moreover, $X$ having a $U(0,1)$ distribution is equivalent to $1-X$ having a $U(0,1)$ distribution, so we often express the transformation more simply as $Y = -\ln X/\lambda.$
Since you want your random variable between $0$ and $1$, though, what you really want is a truncated exponential transform. Probably the easiest way to implement that is the following: Generate a $U(0,1)$ random variable $X$. Then use the formula $Y = - \ln X/\lambda$ to transform that to an exponentially distributed random variable. If this value is between $0$ and $1$ then use it as the output of your function. If this value is not between $0$ and $1$, try the procedure again until you do get an exponentially distributed random variable between $0$ and $1$. (This is a variation of a standard sampling technique, the acceptance-rejection method.)