60 .AddAttribute(
"Stream",
61 "The stream number for this RNG stream. -1 means "
62 "\"allocate a stream automatically\". "
63 "Note that if -1 is set, Get will return -1 so that it "
64 "is not possible to know which "
65 "value was automatically allocated.",
69 MakeIntegerChecker<int64_t>())
70 .AddAttribute(
"Antithetic",
71 "Set this RNG stream to generate antithetic values",
109 return static_cast<uint32_t
>(
GetValue());
131 uint64_t base = ((1ULL) << 63);
132 uint64_t target = base + stream;
158 TypeId(
"ns3::UniformRandomVariable")
160 .SetGroupName(
"Core")
163 "The lower bound on the values returned by this RNG stream.",
166 MakeDoubleChecker<double>())
168 "The upper bound on the values returned by this RNG stream.",
171 MakeDoubleChecker<double>());
212 return static_cast<uint32_t
>(
GetValue((
double)(
min), (
double)(
max) + 1.0));
234 static TypeId tid =
TypeId(
"ns3::ConstantRandomVariable")
236 .SetGroupName(
"Core")
238 .AddAttribute(
"Constant",
239 "The constant value returned by this RNG stream.",
242 MakeDoubleChecker<double>());
286 TypeId(
"ns3::SequentialRandomVariable")
288 .SetGroupName(
"Core")
291 "The first value of the sequence.",
294 MakeDoubleChecker<double>())
296 "One more than the last value of the sequence.",
299 MakeDoubleChecker<double>())
300 .AddAttribute(
"Increment",
301 "The sequence random variable increment.",
302 StringValue(
"ns3::ConstantRandomVariable[Constant=1]"),
304 MakePointerChecker<RandomVariableStream>())
305 .AddAttribute(
"Consecutive",
306 "The number of times each member of the sequence is repeated.",
309 MakeIntegerChecker<uint32_t>());
315 m_currentConsecutive(0),
316 m_isCurrentSet(false)
383 TypeId(
"ns3::ExponentialRandomVariable")
385 .SetGroupName(
"Core")
387 .AddAttribute(
"Mean",
388 "The mean of the values returned by this RNG stream.",
391 MakeDoubleChecker<double>())
392 .AddAttribute(
"Bound",
393 "The upper bound on the values returned by this RNG stream.",
396 MakeDoubleChecker<double>());
434 double r = -mean * std::log(v);
437 if (bound == 0 || r <= bound)
448 return static_cast<uint32_t
>(
GetValue(mean, bound));
464 TypeId(
"ns3::ParetoRandomVariable")
466 .SetGroupName(
"Core")
470 "The scale parameter for the Pareto distribution returned by this RNG stream.",
473 MakeDoubleChecker<double>())
476 "The shape parameter for the Pareto distribution returned by this RNG stream.",
479 MakeDoubleChecker<double>())
482 "The upper bound on the values returned by this RNG stream (if non-zero).",
485 MakeDoubleChecker<double>());
533 double r = (scale * (1.0 / std::pow(v, 1.0 / shape)));
536 if (bound == 0 || r <= bound)
547 return static_cast<uint32_t
>(
GetValue(scale, shape, bound));
563 TypeId(
"ns3::WeibullRandomVariable")
565 .SetGroupName(
"Core")
569 "The scale parameter for the Weibull distribution returned by this RNG stream.",
572 MakeDoubleChecker<double>())
575 "The shape parameter for the Weibull distribution returned by this RNG stream.",
578 MakeDoubleChecker<double>())
579 .AddAttribute(
"Bound",
580 "The upper bound on the values returned by this RNG stream.",
583 MakeDoubleChecker<double>());
619 double exponent = 1.0 / shape;
630 double r = scale * std::pow(-std::log(v), exponent);
633 if (bound == 0 || r <= bound)
644 return static_cast<uint32_t
>(
GetValue(scale, shape, bound));
662 TypeId(
"ns3::NormalRandomVariable")
664 .SetGroupName(
"Core")
666 .AddAttribute(
"Mean",
667 "The mean value for the normal distribution returned by this RNG stream.",
670 MakeDoubleChecker<double>())
673 "The variance value for the normal distribution returned by this RNG stream.",
676 MakeDoubleChecker<double>())
677 .AddAttribute(
"Bound",
678 "The bound on the values returned by this RNG stream.",
681 MakeDoubleChecker<double>());
721 double x2 = mean +
m_v2 *
m_y * std::sqrt(variance);
722 if (std::fabs(x2 - mean) <= bound)
738 double v1 = 2 * u1 - 1;
739 double v2 = 2 * u2 - 1;
740 double w = v1 * v1 + v2 * v2;
743 double y = std::sqrt((-2 * std::log(w)) / w);
744 double x1 = mean + v1 * y * std::sqrt(variance);
746 if (std::fabs(x1 - mean) <= bound)
754 double x2 = mean + v2 * y * std::sqrt(variance);
755 if (std::fabs(x2 - mean) <= bound)
769 return static_cast<uint32_t
>(
GetValue(mean, variance, bound));
785 TypeId(
"ns3::LogNormalRandomVariable")
787 .SetGroupName(
"Core")
791 "The mu value for the log-normal distribution returned by this RNG stream.",
794 MakeDoubleChecker<double>())
797 "The sigma value for the log-normal distribution returned by this RNG stream.",
800 MakeDoubleChecker<double>());
887 r2 = v1 * v1 + v2 * v2;
888 }
while (r2 > 1.0 || r2 == 0);
890 m_normal = std::sqrt(-2.0 * std::log(r2) / r2);
920 TypeId(
"ns3::GammaRandomVariable")
922 .SetGroupName(
"Core")
924 .AddAttribute(
"Alpha",
925 "The alpha value for the gamma distribution returned by this RNG stream.",
928 MakeDoubleChecker<double>())
929 .AddAttribute(
"Beta",
930 "The beta value for the gamma distribution returned by this RNG stream.",
933 MakeDoubleChecker<double>());
986 return GetValue(1.0 + alpha, beta) * std::pow(u, 1.0 / alpha);
992 double d = alpha - 1.0 / 3.0;
993 double c = (1.0 / 3.0) / std::sqrt(d);
1002 double variance = 1.0;
1015 if (u < 1 - 0.0331 *
x *
x *
x *
x)
1019 if (std::log(u) < 0.5 *
x *
x + d * (1 - v + std::log(v)))
1025 return beta * d * v;
1042 double x2 = mean +
m_v2 *
m_y * std::sqrt(variance);
1043 if (std::fabs(x2 - mean) <= bound)
1059 double v1 = 2 * u1 - 1;
1060 double v2 = 2 * u2 - 1;
1061 double w = v1 * v1 + v2 * v2;
1064 double y = std::sqrt((-2 * std::log(w)) / w);
1065 double x1 = mean + v1 * y * std::sqrt(variance);
1067 if (std::fabs(x1 - mean) <= bound)
1075 double x2 = mean + v2 * y * std::sqrt(variance);
1076 if (std::fabs(x2 - mean) <= bound)
1092 TypeId(
"ns3::ErlangRandomVariable")
1094 .SetGroupName(
"Core")
1097 "The k value for the Erlang distribution returned by this RNG stream.",
1100 MakeIntegerChecker<uint32_t>())
1103 "The lambda value for the Erlang distribution returned by this RNG stream.",
1106 MakeDoubleChecker<double>());
1146 double mean = lambda;
1150 for (
unsigned int i = 0; i <
k; ++i)
1162 return static_cast<uint32_t
>(
GetValue(
k, lambda));
1186 double r = -mean * std::log(v);
1189 if (bound == 0 || r <= bound)
1202 TypeId(
"ns3::TriangularRandomVariable")
1204 .SetGroupName(
"Core")
1208 "The mean value for the triangular distribution returned by this RNG stream.",
1211 MakeDoubleChecker<double>())
1212 .AddAttribute(
"Min",
1213 "The lower bound on the values returned by this RNG stream.",
1216 MakeDoubleChecker<double>())
1217 .AddAttribute(
"Max",
1218 "The upper bound on the values returned by this RNG stream.",
1221 MakeDoubleChecker<double>());
1258 double mode = 3.0 * mean -
min -
max;
1270 return min + std::sqrt(u * (
max -
min) * (mode -
min));
1274 return max - std::sqrt((1 - u) * (
max -
min) * (
max - mode));
1298 TypeId(
"ns3::ZipfRandomVariable")
1300 .SetGroupName(
"Core")
1303 "The n value for the Zipf distribution returned by this RNG stream.",
1306 MakeIntegerChecker<uint32_t>())
1307 .AddAttribute(
"Alpha",
1308 "The alpha value for the Zipf distribution returned by this RNG stream.",
1311 MakeDoubleChecker<double>());
1341 for (uint32_t i = 1; i <= n; i++)
1343 m_c += (1.0 / std::pow((
double)i, alpha));
1354 double sum_prob = 0;
1355 double zipf_value = 0;
1356 for (uint32_t i = 1; i <=
m_n; i++)
1358 sum_prob +=
m_c / std::pow((
double)i,
m_alpha);
1372 return static_cast<uint32_t
>(
GetValue(n, alpha));
1388 TypeId(
"ns3::ZetaRandomVariable")
1390 .SetGroupName(
"Core")
1392 .AddAttribute(
"Alpha",
1393 "The alpha value for the zeta distribution returned by this RNG stream.",
1396 MakeDoubleChecker<double>());
1417 m_b = std::pow(2.0, alpha - 1.0);
1441 X = std::floor(std::pow(u, -1.0 / (
m_alpha - 1.0)));
1442 T = std::pow(1.0 + 1.0 / X,
m_alpha - 1.0);
1443 test = v * X * (T - 1.0) / (
m_b - 1.0);
1444 }
while (test > (T /
m_b));
1453 return static_cast<uint32_t
>(
GetValue(alpha));
1468 static TypeId tid =
TypeId(
"ns3::DeterministicRandomVariable")
1470 .SetGroupName(
"Core")
1510 m_data =
new double[length];
1515 for (std::size_t i = 0; i <
m_count; i++)
1541 TypeId(
"ns3::EmpiricalRandomVariable")
1543 .SetGroupName(
"Core")
1545 .AddAttribute(
"Interpolate",
1546 "Treat the CDF as a smooth distribution and interpolate, "
1547 "default is to treat the CDF as a histogram and sample.",
1555 : m_validated(false)
1594 else if (r >=
m_empCdf.rbegin()->first)
1631 auto bound =
m_empCdf.upper_bound(r);
1633 return bound->second;
1661 auto upper =
m_empCdf.upper_bound(r);
1670 double c1 = lower->first;
1671 double c2 = upper->first;
1672 double v1 = lower->second;
1673 double v2 = upper->second;
1675 double value = (v1 + ((v2 - v1) / (c2 - c1)) * (r - c1));
1688 NS_LOG_WARN(
"Empirical CDF already has a value " << vPrevious->second <<
" for CDF " << c
1689 <<
". Overwriting it with value " << v
1706 double vPrev =
m_empCdf.begin()->second;
1709 for (
const auto& cdfPair :
m_empCdf)
1711 const auto& vCurr = cdfPair.second;
1715 NS_FATAL_ERROR(
"Empirical distribution has decreasing CDF values. Current CDF: "
1716 << vCurr <<
", prior CDF: " << vPrev);
1723 auto firstCdfPair =
m_empCdf.begin();
1724 auto lastCdfPair =
m_empCdf.rbegin();
1726 if (firstCdfPair->first < 0.0)
1728 NS_FATAL_ERROR(
"Empirical distribution has invalid first CDF value. CDF: "
1729 << firstCdfPair->first <<
", Value: " << firstCdfPair->second);
1732 if (lastCdfPair->first > 1.0)
1734 NS_FATAL_ERROR(
"Empirical distribution has invalid last CDF value. CDF: "
1735 << lastCdfPair->first <<
", Value: " << lastCdfPair->second);
1747 TypeId(
"ns3::BinomialRandomVariable")
1749 .SetGroupName(
"Core")
1751 .AddAttribute(
"Trials",
1752 "The number of trials.",
1755 MakeIntegerChecker<uint32_t>(0))
1756 .AddAttribute(
"Probability",
1757 "The probability of success in each trial.",
1760 MakeDoubleChecker<double>(0));
1775 double successes = 0;
1777 for (uint32_t i = 0; i < trials; ++i)
1785 if (v <= probability)
1798 return static_cast<uint32_t
>(
GetValue(trials, probability));
1814 TypeId(
"ns3::BernoulliRandomVariable")
1816 .SetGroupName(
"Core")
1818 .AddAttribute(
"Probability",
1819 "The probability of the random variable returning a value of 1.",
1822 MakeDoubleChecker<double>(0));
1843 return (v <= probability) ? 1.0 : 0.0;
1850 return static_cast<uint32_t
>(
GetValue(probability));
NS_ASSERT() and NS_ASSERT_MSG() macro definitions.
ns3::BooleanValue attribute value declarations.
The Bernoulli distribution Random Number Generator (RNG).
double GetValue() override
Get the next random value drawn from the distribution.
BernoulliRandomVariable()
double m_probability
The probability of success.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
static TypeId GetTypeId()
Register this type.
The binomial distribution Random Number Generator (RNG).
double m_probability
The probability of success in each trial.
double GetValue() override
Get the next random value drawn from the distribution.
static TypeId GetTypeId()
Register this type.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
uint32_t m_trials
The number of trials.
The Random Number Generator (RNG) that returns a constant.
static TypeId GetTypeId()
Register this type.
double GetValue() override
Get the next random value drawn from the distribution.
ConstantRandomVariable()
Creates a constant RNG with the default constant value.
double GetConstant() const
Get the constant value returned by this RNG stream.
double m_constant
The constant value returned by this RNG stream.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
The Random Number Generator (RNG) that returns a predetermined sequence.
double GetValue() override
Get the next random value drawn from the distribution.
std::size_t m_next
Position of the next value in the array of values.
void SetValueArray(const std::vector< double > &values)
Sets the array of values that holds the predetermined sequence.
~DeterministicRandomVariable() override
static TypeId GetTypeId()
Register this type.
double * m_data
Array of values to return in sequence.
DeterministicRandomVariable()
Creates a deterministic RNG that will have a predetermined sequence of values.
std::size_t m_count
Size of the array of values.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
The Random Number Generator (RNG) that has a specified empirical distribution.
bool SetInterpolate(bool interpolate)
Switch the mode between sampling the CDF and interpolating.
void CDF(double v, double c)
Specifies a point in the empirical distribution.
bool PreSample(double &value)
Do the initial rng draw and check against the extrema.
double DoSampleCDF(double r)
Sample the CDF as a histogram (without interpolation).
double GetValue() override
Get the next random value drawn from the distribution.
static TypeId GetTypeId()
Register this type.
bool m_interpolate
If true GetValue will interpolate, otherwise treat CDF as normal histogram.
bool m_validated
true once the CDF has been validated.
double DoInterpolate(double r)
Linear interpolation between two points on the CDF to estimate the value at r.
virtual double Interpolate()
Returns the next value in the empirical distribution using linear interpolation.
EmpiricalRandomVariable()
Creates an empirical RNG that has a specified, empirical distribution, and configured for interpolati...
void Validate()
Check that the CDF is valid.
std::map< double, double > m_empCdf
The map of CDF points (x, F(x)).
The Erlang distribution Random Number Generator (RNG) that allows stream numbers to be set determinis...
double m_lambda
The lambda value for the Erlang distribution returned by this RNG stream.
double GetValue() override
Get the next random value drawn from the distribution.
double GetExponentialValue(double mean, double bound)
Returns a random double from an exponential distribution with the specified mean and upper bound.
static TypeId GetTypeId()
Register this type.
uint32_t GetK() const
Returns the k value for the Erlang distribution returned by this RNG stream.
double GetLambda() const
Returns the lambda value for the Erlang distribution returned by this RNG stream.
uint32_t m_k
The k value for the Erlang distribution returned by this RNG stream.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
ErlangRandomVariable()
Creates an Erlang distribution RNG with the default values for k and lambda.
The exponential distribution Random Number Generator (RNG).
ExponentialRandomVariable()
Creates an exponential distribution RNG with the default values for the mean and upper bound.
double GetBound() const
Get the configured upper bound of this RNG.
double m_mean
The mean value of the unbounded exponential distribution.
double GetMean() const
Get the configured mean value of this RNG.
double m_bound
The upper bound on values that can be returned by this RNG stream.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
static TypeId GetTypeId()
Register this type.
double GetValue() override
Get the next random value drawn from the distribution.
The gamma distribution Random Number Generator (RNG) that allows stream numbers to be set determinist...
double GetValue() override
Get the next random value drawn from the distribution.
GammaRandomVariable()
Creates a gamma distribution RNG with the default values for alpha and beta.
double m_alpha
The alpha value for the gamma distribution returned by this RNG stream.
double GetNormalValue(double mean, double variance, double bound)
Returns a random double from a normal distribution with the specified mean, variance,...
double m_y
The algorithm produces two values at a time.
double m_v2
The algorithm produces two values at a time.
bool m_nextValid
True if the next normal value is valid.
static TypeId GetTypeId()
Register this type.
double GetAlpha() const
Returns the alpha value for the gamma distribution returned by this RNG stream.
double GetBeta() const
Returns the beta value for the gamma distribution returned by this RNG stream.
double m_beta
The beta value for the gamma distribution returned by this RNG stream.
Hold a signed integer type.
The log-normal distribution Random Number Generator (RNG) that allows stream numbers to be set determ...
double GetMu() const
Returns the mu value for the log-normal distribution returned by this RNG stream.
double m_v2
The algorithm produces two values at a time.
double GetSigma() const
Returns the sigma value for the log-normal distribution returned by this RNG stream.
double GetValue() override
Get the next random value drawn from the distribution.
bool m_nextValid
True if m_normal is valid.
double m_mu
The mu value for the log-normal distribution returned by this RNG stream.
double m_sigma
The sigma value for the log-normal distribution returned by this RNG stream.
LogNormalRandomVariable()
Creates a log-normal distribution RNG with the default values for mu and sigma.
double m_normal
The algorithm produces two values at a time.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
static TypeId GetTypeId()
Register this type.
The normal (Gaussian) distribution Random Number Generator (RNG) that allows stream numbers to be set...
double m_y
The algorithm produces two values at a time.
double GetBound() const
Returns the bound on values that can be returned by this RNG stream.
double GetVariance() const
Returns the variance value for the normal distribution returned by this RNG stream.
double m_mean
The mean value for the normal distribution returned by this RNG stream.
static TypeId GetTypeId()
Register this type.
double GetMean() const
Returns the mean value for the normal distribution returned by this RNG stream.
static const double INFINITE_VALUE
Large constant to bound the range.
double m_variance
The variance value for the normal distribution returned by this RNG stream.
double GetValue() override
Get the next random value drawn from the distribution.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
double m_bound
The bound on values that can be returned by this RNG stream.
bool m_nextValid
True if the next value is valid.
NormalRandomVariable()
Creates a normal distribution RNG with the default values for the mean, variance, and bound.
double m_v2
The algorithm produces two values at a time.
A base class which provides memory management and object aggregation.
The Pareto distribution Random Number Generator (RNG).
double GetShape() const
Returns the shape parameter for the Pareto distribution returned by this RNG stream.
double m_scale
The scale parameter for the Pareto distribution returned by this RNG stream.
ParetoRandomVariable()
Creates a Pareto distribution RNG with the default values for the mean, the shape,...
static TypeId GetTypeId()
Register this type.
double m_shape
The shape parameter for the Pareto distribution returned by this RNG stream.
double GetScale() const
Returns the scale parameter for the Pareto distribution returned by this RNG stream.
double m_bound
The upper bound on values that can be returned by this RNG stream.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
double GetValue() override
Get the next random value drawn from the distribution.
double GetBound() const
Returns the upper bound on values that can be returned by this RNG stream.
The basic uniform Random Number Generator (RNG).
static TypeId GetTypeId()
Register this type.
RngStream * Peek() const
Get the pointer to the underlying RngStream.
bool IsAntithetic() const
Check if antithetic values will be generated.
virtual double GetValue()=0
Get the next random value drawn from the distribution.
~RandomVariableStream() override
Destructor.
bool m_isAntithetic
Indicates if antithetic values should be generated by this RNG stream.
void SetAntithetic(bool isAntithetic)
Specify whether antithetic values should be generated.
int64_t m_stream
The stream number for the RngStream.
RandomVariableStream()
Default constructor.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
RngStream * m_rng
Pointer to the underlying RngStream.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
int64_t GetStream() const
Returns the stream number for the RngStream.
static uint64_t GetNextStreamIndex()
Get the next automatically assigned stream index.
static uint64_t GetRun()
Get the current run number.
static uint32_t GetSeed()
Get the current seed value which will be used by all subsequently instantiated RandomVariableStream o...
Combined Multiple-Recursive Generator MRG32k3a.
double RandU01()
Generate the next random number for this stream.
The Random Number Generator (RNG) that returns a pattern of sequential values.
uint32_t m_currentConsecutive
The number of times the current distinct value has been repeated.
double m_min
The first value of the sequence.
Ptr< RandomVariableStream > GetIncrement() const
Get the increment for the sequence.
uint32_t m_consecutive
The number of times each distinct value is repeated.
static TypeId GetTypeId()
Register this type.
double m_current
The current sequence value.
double m_max
Strict upper bound on the sequence.
Ptr< RandomVariableStream > m_increment
Increment between distinct values.
double GetValue() override
Get the next random value drawn from the distribution.
uint32_t GetConsecutive() const
Get the number of times each distinct value of the sequence is repeated before incrementing to the ne...
double GetMax() const
Get the limit of the sequence, which is (at least) one more than the last value of the sequence.
SequentialRandomVariable()
Creates a sequential RNG with the default values for the sequence parameters.
double GetMin() const
Get the first value of the sequence.
bool m_isCurrentSet
Indicates if the current sequence value has been properly initialized.
Hold variables of type string.
The triangular distribution Random Number Generator (RNG) that allows stream numbers to be set determ...
double GetValue() override
Get the next random value drawn from the distribution.
double GetMean() const
Returns the mean value for the triangular distribution returned by this RNG stream.
static TypeId GetTypeId()
Register this type.
double m_mean
The mean value for the triangular distribution returned by this RNG stream.
double m_max
The upper bound on values that can be returned by this RNG stream.
double GetMax() const
Returns the upper bound on values that can be returned by this RNG stream.
TriangularRandomVariable()
Creates a triangular distribution RNG with the default values for the mean, lower bound,...
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
double m_min
The lower bound on values that can be returned by this RNG stream.
double GetMin() const
Returns the lower bound for the triangular distribution returned by this RNG stream.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
The Weibull distribution Random Number Generator (RNG) which allows stream numbers to be set determin...
double m_shape
The shape parameter for the Weibull distribution returned by this RNG stream.
double m_bound
The upper bound on values that can be returned by this RNG stream.
double m_scale
The scale parameter for the Weibull distribution returned by this RNG stream.
double GetBound() const
Returns the upper bound on values that can be returned by this RNG stream.
double GetValue() override
Get the next random value drawn from the distribution.
WeibullRandomVariable()
Creates a Weibull distribution RNG with the default values for the scale, shape, and upper bound.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
static TypeId GetTypeId()
Register this type.
double GetScale() const
Returns the scale parameter for the Weibull distribution returned by this RNG stream.
double GetShape() const
Returns the shape parameter for the Weibull distribution returned by this RNG stream.
The zeta distribution Random Number Generator (RNG) that allows stream numbers to be set deterministi...
static TypeId GetTypeId()
Register this type.
double m_alpha
The alpha value for the zeta distribution returned by this RNG stream.
double GetValue() override
Get the next random value drawn from the distribution.
ZetaRandomVariable()
Creates a zeta distribution RNG with the default value for alpha.
double GetAlpha() const
Returns the alpha value for the zeta distribution returned by this RNG stream.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
double m_b
Just for calculus simplifications.
The Zipf distribution Random Number Generator (RNG) that allows stream numbers to be set deterministi...
uint32_t GetN() const
Returns the n value for the Zipf distribution returned by this RNG stream.
static TypeId GetTypeId()
Register this type.
double m_c
The normalization constant.
double GetAlpha() const
Returns the alpha value for the Zipf distribution returned by this RNG stream.
ZipfRandomVariable()
Creates a Zipf distribution RNG with the default values for n and alpha.
double m_alpha
The alpha value for the Zipf distribution returned by this RNG stream.
uint32_t m_n
The n value for the Zipf distribution returned by this RNG stream.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
double GetValue() override
Get the next random value drawn from the distribution.
ns3::DoubleValue attribute value declarations and template implementations.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
ns3::IntegerValue attribute value declarations and template implementations.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
ns3::PointerValue attribute value declarations and template implementations.
ns3::RandomVariableStream declaration, and related classes.
ns3::RngSeedManager declaration.
ns3::RngStream declaration.
ns3::StringValue attribute value declarations.