Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2002/iii/paper-40/1/b/ii/solution

Integration of the Laplace distribution probability density function gives
Solving these two equations for gives
Generate one uniform and return this piecewise expression. The branches agree at and the inverse transform sampling proof establishes the target law without any rejection step.

New to topics? Read the docs here!