5 Mar
2016
5 Mar
'16
1:25 p.m.
Suppose, for some reason, you need to generate random variables whose normalized probability distribution is P(z) = (1/pi) BesselK[0] ( |z| ). Here's a clever way to do it without having to muck with Bessel functions. Let x and y be independent Gaussian random variables with zero mean and unit variance. Then z = xy has the desired distribution. Furthermore, the sum of n such products, has distribution P[n](z) = (1 / (sqrt(pi) Gamma(n/2)) (|z| / 2)^((n-1)/2) BesselK[((n-1)/2] ( |z| ). -- Gene