The Ziggurat Algorithm for Random Gaussian Sampling
heliosphan.org
heliosphan.org
I always especially liked the fact that it constructed its table lazily and could do so given nothing but a handful of functions and a constant (the PDF itself, its inverse, its definite integral from 0, and the limit of that integral at infinity). From those pieces, it builds the tables and an algorithm to sample, and optionally also recursively transforms those inputs as necessary to lazily construct another ziggurat representation of the tail, ad infinitum. Basically, you can throw any monotone PDF you want at it and not have to worry about solving or approximating the tail analytically.
[1]https://github.com/mokus0/random-fu/blob/master/random-fu/sr...
http://svn.code.sf.net/p/sharpneat/code/branches/V2/src/Shar...
Note it's a lot simpler (more elegant) than the Ziggurat method!
Also note the while loop rejects sqr==0 because that would cause Log(0) to throw an exception. I convinced myself that was correct when I wrote it in 2011, but I'm struggling to remember how I came to that conclusion.
Also, Ziggurat can be applied to any distribution with a decreasing PMF (e.g. it's also amazingly fast for the Exponential distribution), whereas Box-Muller relies on special properties of the Normal.
(random()+random()+random()+random()-2.0)*sqrt(3.)
as a cheap (in terms of brain power) Gaussian (sigma=1, mean=0) rough approximation :-)
Built on top of Chebfun, http://www.chebfun.org
But I guess this slows down the fast path a little, so with sufficiently low rejection probability it is not worth it.
It would be interesting to explore these options further.