## Function describing probability

Not sure this is technically a calculus question, but if not, it will probably be an easy answer.

I'm a programmer trying to write a procedure that will produce an arbitrarily chosen number in a given range, the probability of which is described by a nice gaussian function.

I have the function written just the way I want so that it describes a curve that exists mostly between x=0 and x=1 and reaches a peak at (0.5, 1)

e^-((x-0.5)^2/0.04)

What I can't figure out, is how do I reverse engineer this function so that, given a random number between 0 and 1, I can transform it to a different number between 0 and 1, the probability of which is described by the function above.

It is a math problem, not a programming problem. I know how to do the programming, I just can't figure out the math. Is this a simple math problem that I just don't remember how to do? (forgive me, my calculus is 10 years old and rusty)