nextValue() {
        let x2, v0, v1, x, u, v;
        while(true){
            do {
                x = this.randn.nextValue();
                v = 1 + this.c * x;
            }while (v <= 0);
            v *= v * v;
            x2 = x * x;
            v0 = 1 - 0.331 * x2 * x2;
            v1 = 0.5 * x2 + this.d * (1 - v + Math.log(v));
            u = this.randu();
            if (u < v0 || Math.log(u) < v1) break;
        }
        v = 1 / this.beta * this.d * v;
        if (this.alpha < 1) v *= Math.pow(this.randu(), 1 / this.alpha);
        return this.convertValue(v);
    }
Returns next sample from a gamma distribution.