code: public static function BETADIST($value, $alpha, $beta, $rMin = 0, $rMax = 1)
      {
          $value = Functions::flattenSingleValue($value);
          $alpha = Functions::flattenSingleValue($alpha);
          $beta = Functions::flattenSingleValue($beta);
          $rMin = Functions::flattenSingleValue($rMin);
          $rMax = Functions::flattenSingleValue($rMax);
  
          if ((is_numeric($value)) && (is_numeric($alpha)) && (is_numeric($beta)) && (is_numeric($rMin)) && (is_numeric($rMax))) {
              if (($value < $rMin) || ($value > $rMax) || ($alpha <= 0) || ($beta <= 0) || ($rMin == $rMax)) {
                  return Functions::NAN();
              }
              if ($rMin > $rMax) {
                  $tmp = $rMin;
                  $rMin = $rMax;
                  $rMax = $tmp;
              }
              $value -= $rMin;
              $value /= ($rMax - $rMin);
  
              return self::incompleteBeta($value, $alpha, $beta);
          }
  
          return Functions::VALUE();
      }
docs: BETADIST.
  
  Returns the beta distribution.
  
  @param float $value Value at which you want to evaluate the distribution
  @param float $alpha Parameter to the distribution
  @param float $beta Parameter to the distribution
  @param mixed $rMin
  @param mixed $rMax
  
  @return float