Source: https://www.math.u-bordeaux.fr/~mibonnef/cpp-stat/stat-tp.pdf