/** * Returns a random float between $mu and $mu plus $variance * * @return float The random variate. */ public function rvs() { return $this->calculator->getRvs($this->mu, $this->variance); }
/** * Returns a random float between $minimum and $minimum plus $maximum * * @param float $df The degrees of freedeom. Default 1 * @return float The random variate. */ public function getRvs($df = 1) { $Z = parent::getRvs(0, 1); $V = $this->chi->getRvs($df); return $Z / sqrt($V / $df); }
/** * Returns a Cauchy-distributed random float * * @param float $mu The location parameter * @param float $gamma The scale parameter * @return float The random variate. */ public function getRvs($mu = 0.0, $gamma = 1.0) { $u = $this->normal->getRvs(0, 1); $v = $this->normal->getRvs(0, 1); return $gamma * ($u / $v) + $mu; }