Use the ratio-of-uniforms method on
Writing gives and . Consequently
because the derivative vanishes at . Thus the normal ratio-of-uniforms envelope is the rectangle , .
Generate independent with uniform distribution on , set and , and accept precisely when
Reject and repeat otherwise. On acceptance return . One can compare logarithms instead of exponentials to avoid underflow.
For a proof, the change of variables has Jacobian determinant . A uniform point in therefore gives an -density proportional to
Normalizing yields the required normal distribution with mean zero and variance . The region area is ; dividing it by the rectangle area gives acceptance probability .

Articles by others on the same topic (0)

There are currently no matching articles.