core: Add functions to calculate mean for Weibull distribution

This commit is contained in:
Sébastien Deronne
2024-01-07 10:21:49 +01:00
committed by Sébastien Deronne
parent 10f5371ff3
commit c834704d89
2 changed files with 27 additions and 0 deletions

View File

@@ -612,6 +612,20 @@ WeibullRandomVariable::GetBound() const
return m_bound;
}
double
WeibullRandomVariable::GetMean(double scale, double shape)
{
NS_LOG_FUNCTION(scale << shape);
return scale * std::tgamma(1 + (1 / shape));
}
double
WeibullRandomVariable::GetMean() const
{
NS_LOG_FUNCTION(this);
return GetMean(m_scale, m_shape);
}
double
WeibullRandomVariable::GetValue(double scale, double shape, double bound)
{

View File

@@ -862,6 +862,19 @@ class WeibullRandomVariable : public RandomVariableStream
*/
double GetBound() const;
/**
* \brief Returns the mean value for the Weibull distribution returned by this RNG stream.
* \return The mean value for the Weibull distribution returned by this RNG stream.
*/
double GetMean() const;
/**
* \copydoc GetMean()
* \param [in] scale Scale parameter for the Weibull distribution.
* \param [in] shape Shape parameter for the Weibull distribution.
*/
static double GetMean(double scale, double shape);
/**
* \copydoc GetValue()
* \param [in] scale Scale parameter for the Weibull distribution.