51 .AddAttribute(
"Stream",
52 "The stream number for this RNG stream. -1 means "
53 "\"allocate a stream automatically\". "
54 "Note that if -1 is set, Get will return -1 so that it "
55 "is not possible to know which "
56 "value was automatically allocated.",
61 .AddAttribute(
"Antithetic",
62 "Set this RNG stream to generate antithetic values",
99 <<
" integer value: " << value <<
" stream: " <<
GetStream());
123 uint64_t base = ((1ULL) << 63);
124 uint64_t target = base + stream;
149 TypeId(
"ns3::UniformRandomVariable")
151 .SetGroupName(
"Core")
154 "The lower bound on the values returned by this RNG stream.",
159 "The upper bound on the values returned by this RNG stream.",
201 auto v =
static_cast<uint32_t>(
GetValue((
double)(min), (
double)(max) + 1.0));
226 static TypeId tid =
TypeId(
"ns3::ConstantRandomVariable")
228 .SetGroupName(
"Core")
230 .AddAttribute(
"Constant",
231 "The constant value returned by this RNG stream.",
277 TypeId(
"ns3::SequentialRandomVariable")
279 .SetGroupName(
"Core")
282 "The first value of the sequence.",
287 "One more than the last value of the sequence.",
291 .AddAttribute(
"Increment",
292 "The sequence random variable increment.",
293 StringValue(
"ns3::ConstantRandomVariable[Constant=1]"),
296 .AddAttribute(
"Consecutive",
297 "The number of times each member of the sequence is repeated.",
306 m_currentConsecutive(0),
307 m_isCurrentSet(false)
370 TypeId(
"ns3::ExponentialRandomVariable")
372 .SetGroupName(
"Core")
374 .AddAttribute(
"Mean",
375 "The mean of the values returned by this RNG stream.",
379 .AddAttribute(
"Bound",
380 "The upper bound on the values returned by this RNG stream.",
418 double r = -mean * std::log(v);
421 if (bound == 0 || r <= bound)
424 <<
" bound: " << bound);
436 <<
" bound: " << bound);
452 TypeId(
"ns3::ParetoRandomVariable")
454 .SetGroupName(
"Core")
458 "The scale parameter for the Pareto distribution returned by this RNG stream.",
464 "The shape parameter for the Pareto distribution returned by this RNG stream.",
470 "The upper bound on the values returned by this RNG stream (if non-zero).",
515 double r = (scale * (1.0 / std::pow(v, 1.0 / shape)));
518 if (bound == 0 || r <= bound)
521 <<
" shape: " << shape <<
" bound: " << bound);
532 <<
" shape: " << shape <<
" bound: " << bound);
548 TypeId(
"ns3::WeibullRandomVariable")
550 .SetGroupName(
"Core")
554 "The scale parameter for the Weibull distribution returned by this RNG stream.",
560 "The shape parameter for the Weibull distribution returned by this RNG stream.",
564 .AddAttribute(
"Bound",
565 "The upper bound on the values returned by this RNG stream.",
601 return scale * std::tgamma(1 + (1 / shape));
614 double exponent = 1.0 / shape;
625 double r = scale * std::pow(-std::log(v), exponent);
628 if (bound == 0 || r <= bound)
631 <<
" shape: " << shape <<
" bound: " << bound);
642 <<
" shape: " << shape <<
" bound: " << bound);
661 TypeId(
"ns3::NormalRandomVariable")
663 .SetGroupName(
"Core")
665 .AddAttribute(
"Mean",
666 "The mean value for the normal distribution returned by this RNG stream.",
672 "The variance value for the normal distribution returned by this RNG stream.",
676 .AddAttribute(
"Bound",
677 "The bound on the values returned by this RNG stream.",
716 double x2 = mean +
m_v2 *
m_y * std::sqrt(variance);
717 if (std::fabs(x2 - mean) <= bound)
720 <<
" variance: " << variance <<
" bound: " << bound);
735 double v1 = 2 * u1 - 1;
736 double v2 = 2 * u2 - 1;
737 double w = v1 * v1 + v2 * v2;
740 double y = std::sqrt((-2 * std::log(w)) / w);
741 double x1 = mean + v1 * y * std::sqrt(variance);
743 if (std::fabs(x1 - mean) <= bound)
749 <<
" variance: " << variance <<
" bound: " << bound);
753 double x2 = mean + v2 * y * std::sqrt(variance);
754 if (std::fabs(x2 - mean) <= bound)
758 <<
" variance: " << variance <<
" bound: " << bound);
771 <<
" variance: " << variance <<
" bound: " << bound);
787 TypeId(
"ns3::LogNormalRandomVariable")
789 .SetGroupName(
"Core")
793 "The mu value for the log-normal distribution returned by this RNG stream.",
799 "The sigma value for the log-normal distribution returned by this RNG stream.",
848 <<
" sigma: " << sigma);
874 r2 = v1 * v1 + v2 * v2;
875 }
while (r2 > 1.0 || r2 == 0);
877 m_normal = std::sqrt(-2.0 * std::log(r2) / r2);
882 x = std::exp(sigma *
normal + mu);
884 <<
" sigma: " << sigma);
894 <<
" sigma: " << sigma);
910 TypeId(
"ns3::GammaRandomVariable")
912 .SetGroupName(
"Core")
914 .AddAttribute(
"Alpha",
915 "The alpha value for the gamma distribution returned by this RNG stream.",
919 .AddAttribute(
"Beta",
920 "The beta value for the gamma distribution returned by this RNG stream.",
973 double v =
GetValue(1.0 + alpha, beta) * std::pow(u, 1.0 / alpha);
975 <<
" beta: " << beta);
976 return GetValue(1.0 + alpha, beta) * std::pow(u, 1.0 / alpha);
982 double d = alpha - 1.0 / 3.0;
983 double c = (1.0 / 3.0) / std::sqrt(d);
992 double variance = 1.0;
1005 if (u < 1 - 0.0331 * x * x * x * x)
1009 if (std::log(u) < 0.5 * x * x + d * (1 - v + std::log(v)))
1015 double value = beta * d * v;
1017 <<
" beta: " << beta);
1033 double x2 = mean +
m_v2 *
m_y * std::sqrt(variance);
1034 if (std::fabs(x2 - mean) <= bound)
1037 <<
" variance: " << variance <<
" bound: " << bound);
1052 double v1 = 2 * u1 - 1;
1053 double v2 = 2 * u2 - 1;
1054 double w = v1 * v1 + v2 * v2;
1057 double y = std::sqrt((-2 * std::log(w)) / w);
1058 double x1 = mean + v1 * y * std::sqrt(variance);
1060 if (std::fabs(x1 - mean) <= bound)
1066 <<
" variance: " << variance <<
" bound: " << bound);
1070 double x2 = mean + v2 * y * std::sqrt(variance);
1071 if (std::fabs(x2 - mean) <= bound)
1075 <<
" variance: " << variance <<
" bound: " << bound);
1089 TypeId(
"ns3::ErlangRandomVariable")
1091 .SetGroupName(
"Core")
1094 "The k value for the Erlang distribution returned by this RNG stream.",
1100 "The lambda value for the Erlang distribution returned by this RNG stream.",
1140 double mean = lambda;
1144 for (
unsigned int i = 0; i < k; ++i)
1149 <<
" lambda: " << lambda);
1158 <<
" lambda: " << lambda);
1181 double r = -mean * std::log(v);
1184 if (bound == 0 || r <= bound)
1187 <<
" bound: " << bound);
1199 TypeId(
"ns3::TriangularRandomVariable")
1201 .SetGroupName(
"Core")
1205 "The mean value for the triangular distribution returned by this RNG stream.",
1209 .AddAttribute(
"Min",
1210 "The lower bound on the values returned by this RNG stream.",
1214 .AddAttribute(
"Max",
1215 "The upper bound on the values returned by this RNG stream.",
1251 double mode = 3.0 * mean - min - max;
1261 if (u <= (mode - min) / (max - min))
1263 double v = min + std::sqrt(u * (max - min) * (mode - min));
1265 <<
" min: " << min <<
" max: " << max);
1270 double v = max - std::sqrt((1 - u) * (max - min) * (max - mode));
1272 <<
" min: " << min <<
" max: " << max);
1282 <<
" min: " << min <<
" max: " << max);
1298 TypeId(
"ns3::ZipfRandomVariable")
1300 .SetGroupName(
"Core")
1303 "The n value for the Zipf distribution returned by this RNG stream.",
1307 .AddAttribute(
"Alpha",
1308 "The alpha value for the Zipf distribution returned by this RNG stream.",
1340 m_c += (1.0 / std::pow((
double)i, alpha));
1351 double sum_prob = 0;
1352 double zipf_value = 0;
1355 sum_prob +=
m_c / std::pow((
double)i, alpha);
1363 <<
" alpha: " << alpha);
1373 <<
" alpha: " << alpha);
1389 TypeId(
"ns3::ZetaRandomVariable")
1391 .SetGroupName(
"Core")
1393 .AddAttribute(
"Alpha",
1394 "The alpha value for the zeta distribution returned by this RNG stream.",
1416 m_b = std::pow(2.0, alpha - 1.0);
1440 X = std::floor(std::pow(u, -1.0 / (alpha - 1.0)));
1441 T = std::pow(1.0 + 1.0 / X, alpha - 1.0);
1442 test = v * X * (T - 1.0) / (
m_b - 1.0);
1467 static TypeId tid =
TypeId(
"ns3::DeterministicRandomVariable")
1469 .SetGroupName(
"Core")
1509 m_data =
new double[length];
1514 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)
1593 else if (r >=
m_empCdf.rbegin()->first)
1629 auto bound =
m_empCdf.upper_bound(r);
1631 return bound->second;
1659 auto upper =
m_empCdf.upper_bound(r);
1660 auto lower = std::prev(upper, 1);
1668 double c1 = lower->first;
1669 double c2 = upper->first;
1670 double v1 = lower->second;
1671 double v2 = upper->second;
1673 double value = (v1 + ((v2 - v1) / (c2 - c1)) * (r - c1));
1686 NS_LOG_WARN(
"Empirical CDF already has a value " << vPrevious->second <<
" for CDF " << c
1687 <<
". Overwriting it with value " << v
1704 double vPrev =
m_empCdf.begin()->second;
1707 for (
const auto& cdfPair :
m_empCdf)
1709 const auto& vCurr = cdfPair.second;
1713 NS_FATAL_ERROR(
"Empirical distribution has decreasing CDF values. Current CDF: "
1714 << vCurr <<
", prior CDF: " << vPrev);
1721 auto firstCdfPair =
m_empCdf.begin();
1722 auto lastCdfPair =
m_empCdf.rbegin();
1724 if (firstCdfPair->first < 0.0)
1726 NS_FATAL_ERROR(
"Empirical distribution has invalid first CDF value. CDF: "
1727 << firstCdfPair->first <<
", Value: " << firstCdfPair->second);
1730 if (lastCdfPair->first > 1.0)
1732 NS_FATAL_ERROR(
"Empirical distribution has invalid last CDF value. CDF: "
1733 << lastCdfPair->first <<
", Value: " << lastCdfPair->second);
1745 TypeId(
"ns3::BinomialRandomVariable")
1747 .SetGroupName(
"Core")
1749 .AddAttribute(
"Trials",
1750 "The number of trials.",
1754 .AddAttribute(
"Probability",
1755 "The probability of success in each trial.",
1771 double successes = 0;
1773 for (
uint32_t i = 0; i < trials; ++i)
1781 if (v <= probability)
1787 <<
" probability: " << probability);
1796 <<
" probability: " << probability);
1812 TypeId(
"ns3::BernoulliRandomVariable")
1814 .SetGroupName(
"Core")
1816 .AddAttribute(
"Probability",
1817 "The probability of the random variable returning a value of 1.",
1839 double value = (v <= probability) ? 1.0 : 0.0;
1841 <<
" probability: " << probability);
1850 <<
" probability: " << probability);
1866 TypeId(
"ns3::LaplacianRandomVariable")
1868 .SetGroupName(
"Core")
1870 .AddAttribute(
"Location",
1871 "The location parameter for the Laplacian distribution returned by this "
1878 "The scale parameter for the Laplacian distribution returned by this RNG stream.",
1882 .AddAttribute(
"Bound",
1883 "The bound on the values returned by this RNG stream.",
1917 NS_ABORT_MSG_IF(scale <= 0,
"Scale parameter should be larger than 0");
1929 const auto sgn = (v > 0) ? 1 : ((v < 0) ? -1 : 0);
1930 const auto r = location - (scale * sgn * std::log(1.0 - (2.0 * std::abs(v))));
1933 if (bound == 0.0 || std::fabs(r - location) <= bound)
1958 return 2.0 * std::pow(scale, 2.0);
1973 TypeId(
"ns3::LargestExtremeValueRandomVariable")
1975 .SetGroupName(
"Core")
1977 .AddAttribute(
"Location",
1978 "The location parameter for the Largest Extreme Value distribution "
1979 "returned by this RNG stream.",
1983 .AddAttribute(
"Scale",
1984 "The scale parameter for the Largest Extreme Value distribution "
1985 "returned by this RNG stream.",
2013 NS_ABORT_MSG_IF(scale <= 0,
"Scale parameter should be larger than 0");
2023 const auto t = std::log(v) * (-1.0);
2024 const auto r = location - (scale * std::log(t));
2047 return (location + (scale * std::numbers::egamma));
2060 return std::pow((scale * std::numbers::pi), 2) / 6.0;
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 laplacian distribution Random Number Generator (RNG).
double m_location
The location value of the laplacian distribution.
double GetValue() override
Get the next random value drawn from the distribution.
double GetBound() const
Get the configured bound of this RNG.
static TypeId GetTypeId()
Register this type.
double m_bound
The bound on values that can be returned by this RNG stream.
LaplacianRandomVariable()
Creates an unbounded laplacian distribution RNG with the default values for the location and the scal...
double GetLocation() const
Get the configured location value of this RNG.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
double m_scale
The scale value of the laplacian distribution.
double GetScale() const
Get the configured scale value of this RNG.
double GetVariance() const
Returns the variance value for the laplacian distribution returned by this RNG stream.
The Largest Extreme Value distribution Random Number Generator (RNG).
double m_scale
The scale value of the Largest Extreme Value distribution.
double GetMean() const
Returns the mean value for the Largest Extreme Value distribution returned by this RNG stream.
double GetValue() override
Get the next random value drawn from the distribution.
static TypeId GetTypeId()
Register this type.
LargestExtremeValueRandomVariable()
Creates a Largest Extreme Value distribution RNG with the default values for the location and the sca...
double GetVariance() const
Returns the variance value for the Largest Extreme Value distribution returned by this RNG stream.
double GetScale() const
Get the configured scale value of this RNG.
virtual uint32_t GetInteger()
Get the next random value drawn from the distribution.
double GetLocation() const
Get the configured location value of this RNG.
double m_location
The location value of the Largest Extreme Value distribution.
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.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
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.
Smart pointer class similar to boost::intrusive_ptr.
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 GetMean() const
Returns the mean value 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,...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#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_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#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 AttributeChecker > MakeIntegerChecker()
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
-ns3 Test suite for the ns3 wrapper script
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.
ns3::UintegerValue attribute value declarations and template implementations.