Inspired from: http://www.johndcook.com/julia_rng.html