Source: http://www.iro.umontreal.ca/~lecuyer/ift3240/output-p1.pdf