Skip to content

Instantly share code, notes, and snippets.

@fiurthorn
fiurthorn / NormalDistribution.ts
Last active February 16, 2022 06:10
Normal Distribution in javascript
/**
* https://en.wikipedia.org/wiki/Marsaglia_polar_method
*
* @param {*} mean Mittel
* @param {*} sd Spreitzung
*/
export function NormalDistribution(mean, sd) {
this._cache = [];
this.mean = mean;
this.sd = sd;