Source: https://www.di.ens.fr/pierre.boutillier/ENSL/L3BI/L3BI-algo-td3.pdf