public function __construct($shape, $scale, GeneratorInterface $rnd = null) { parent::__construct($rnd); $this->scale = $scale; $this->shape = abs($shape); if ($this->shape >= 1) { $this->normal = new Normal(0, 1, $this->rnd); } else { $this->gamma = new Gamma($this->shape + 1, 1, $this->rnd); } }
public function __construct($a, $k, GeneratorI $rnd = null) { parent::__construct($rnd); $k = (int) abs($k); if (!is_array($a)) { $a = array_fill_keys(range(0, $k - 1), $a); } $rnd = $this->rnd; $this->gamma = array_map(function ($a) use($rnd) { return new Gamma($a, 1, $rnd); }, $a); }
public function __construct($m = 0.0, $sigma = 1.0, GeneratorInterface $rnd = null) { parent::__construct($rnd); $this->m = $m; $this->sigma = abs($sigma); }