コード例 #1
0
ファイル: Normal.php プロジェクト: icomefromthenet/faker
 /**
  * Returns the moments of the distribution
  * 
  * @param string $moments Which moments to compute. m for mean, v for variance, s for skew, k for kurtosis.  Default 'mv'
  * @return type array A dictionary containing the first four moments of the distribution
  */
 public function stats($moments = 'mv')
 {
     return $this->calculator->getStats($moments, $this->mu, $this->variance);
 }
コード例 #2
0
ファイル: StudentsT.php プロジェクト: icomefromthenet/faker
 /**
  * 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);
 }
コード例 #3
0
ファイル: Cauchy.php プロジェクト: icomefromthenet/faker
 /**
  * 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;
 }