nextValue() {
        if (!isNaN(this.nextVal)) {
            const value = this.nextVal;
            this.nextVal = NaN;
            return value;
        }
        let resultX, resultY;
        let isValid = false;
        while(!isValid){
            let v1, v2, s;
            do {
                v1 = 2 * this.random() - 1;
                v2 = 2 * this.random() - 1;
                s = v1 * v1 + v2 * v2;
            }while (s >= 1 || s === 0);
            const mul = Math.sqrt(-2 * Math.log(s) / s);
            resultX = this.mean + this.stdDev * v1 * mul;
            resultY = this.mean + this.stdDev * v2 * mul;
            if (!this.truncated || this.isValidTruncated(resultX)) isValid = true;
        }
        if (!this.truncated || this.isValidTruncated(resultY)) this.nextVal = this.convertValue(resultY);
        return this.convertValue(resultX);
    }
Returns next sample from a Gaussian distribution.