58 .SetGroupName (
"Core")
59 .AddAttribute (
"Stream",
60 "The stream number for this RNG stream. -1 means \"allocate a stream automatically\". "
61 "Note that if -1 is set, Get will return -1 so that it is not possible to know which "
62 "value was automatically allocated.",
66 MakeIntegerChecker<int64_t>())
67 .AddAttribute (
"Antithetic",
"Set this RNG stream to generate antithetic values",
111 NS_ASSERT (nextStream <= ((1ULL) << 63));
120 uint64_t base = ((1ULL) << 63);
121 uint64_t target = base + stream;
147 static TypeId tid =
TypeId (
"ns3::UniformRandomVariable")
149 .SetGroupName (
"Core")
151 .AddAttribute (
"Min",
"The lower bound on the values returned by this RNG stream.",
154 MakeDoubleChecker<double>())
155 .AddAttribute (
"Max",
"The upper bound on the values returned by this RNG stream.",
158 MakeDoubleChecker<double>())
197 return static_cast<uint32_t
> (
GetValue ((
double) (
min), (
double) (
max) + 1.0) );
218 static TypeId tid =
TypeId (
"ns3::ConstantRandomVariable")
220 .SetGroupName (
"Core")
222 .AddAttribute (
"Constant",
"The constant value returned by this RNG stream.",
225 MakeDoubleChecker<double>())
273 static TypeId tid =
TypeId (
"ns3::SequentialRandomVariable")
275 .SetGroupName (
"Core")
277 .AddAttribute (
"Min",
"The first value of the sequence.",
280 MakeDoubleChecker<double>())
281 .AddAttribute (
"Max",
"One more than the last value of the sequence.",
284 MakeDoubleChecker<double>())
285 .AddAttribute (
"Increment",
"The sequence random variable increment.",
286 StringValue (
"ns3::ConstantRandomVariable[Constant=1]"),
288 MakePointerChecker<RandomVariableStream> ())
289 .AddAttribute (
"Consecutive",
"The number of times each member of the sequence is repeated.",
292 MakeIntegerChecker<uint32_t>());
298 m_currentConsecutive (0),
299 m_isCurrentSet (false)
372 static TypeId tid =
TypeId (
"ns3::ExponentialRandomVariable")
374 .SetGroupName (
"Core")
376 .AddAttribute (
"Mean",
"The mean of the values returned by this RNG stream.",
379 MakeDoubleChecker<double>())
380 .AddAttribute (
"Bound",
"The upper bound on the values returned by this RNG stream.",
383 MakeDoubleChecker<double>())
420 double r = -mean*std::log (v);
423 if (bound == 0 || r <= bound)
433 return static_cast<uint32_t
> (
GetValue (mean, bound) );
454 static TypeId tid =
TypeId (
"ns3::ParetoRandomVariable")
456 .SetGroupName (
"Core")
458 .AddAttribute (
"Mean",
"The mean parameter for the Pareto distribution returned by this RNG stream.",
461 MakeDoubleChecker<double>(),
463 "Not anymore used. Use 'Scale' instead - changing this attribute has no effect.")
464 .AddAttribute (
"Scale",
"The scale parameter for the Pareto distribution returned by this RNG stream.",
467 MakeDoubleChecker<double>())
468 .AddAttribute (
"Shape",
"The shape parameter for the Pareto distribution returned by this RNG stream.",
471 MakeDoubleChecker<double>())
472 .AddAttribute (
"Bound",
"The upper bound on the values returned by this RNG stream (if non-zero).",
475 MakeDoubleChecker<double>())
524 double r = (scale * ( 1.0 / std::pow (v, 1.0 / shape)));
527 if (bound == 0 || r <= bound)
537 return static_cast<uint32_t
> (
GetValue (scale, shape, bound) );
558 static TypeId tid =
TypeId (
"ns3::WeibullRandomVariable")
560 .SetGroupName (
"Core")
562 .AddAttribute (
"Scale",
"The scale parameter for the Weibull distribution returned by this RNG stream.",
565 MakeDoubleChecker<double>())
566 .AddAttribute (
"Shape",
"The shape parameter for the Weibull distribution returned by this RNG stream.",
569 MakeDoubleChecker<double>())
570 .AddAttribute (
"Bound",
"The upper bound on the values returned by this RNG stream.",
573 MakeDoubleChecker<double>())
607 double exponent = 1.0 / shape;
618 double r = scale * std::pow ( -std::log (v), exponent);
621 if (bound == 0 || r <= bound)
631 return static_cast<uint32_t
> (
GetValue (scale, shape, bound) );
654 static TypeId tid =
TypeId (
"ns3::NormalRandomVariable")
656 .SetGroupName (
"Core")
658 .AddAttribute (
"Mean",
"The mean value for the normal distribution returned by this RNG stream.",
661 MakeDoubleChecker<double>())
662 .AddAttribute (
"Variance",
"The variance value for the normal distribution returned by this RNG stream.",
665 MakeDoubleChecker<double>())
666 .AddAttribute (
"Bound",
"The bound on the values returned by this RNG stream.",
669 MakeDoubleChecker<double>())
708 double x2 = mean +
m_v2 *
m_y * std::sqrt (variance);
709 if (std::fabs (x2 - mean) <= bound)
725 double v1 = 2 * u1 - 1;
726 double v2 = 2 * u2 - 1;
727 double w = v1 * v1 + v2 * v2;
730 double y = std::sqrt ((-2 * std::log (w)) / w);
731 double x1 = mean + v1 * y * std::sqrt (variance);
733 if (std::fabs (x1 - mean) <= bound)
741 double x2 = mean + v2 * y * std::sqrt (variance);
742 if (std::fabs (x2 - mean) <= bound)
756 return static_cast<uint32_t
> (
GetValue (mean, variance, bound) );
777 static TypeId tid =
TypeId (
"ns3::LogNormalRandomVariable")
779 .SetGroupName (
"Core")
781 .AddAttribute (
"Mu",
"The mu value for the log-normal distribution returned by this RNG stream.",
784 MakeDoubleChecker<double>())
785 .AddAttribute (
"Sigma",
"The sigma value for the log-normal distribution returned by this RNG stream.",
788 MakeDoubleChecker<double>())
861 r2 = v1 * v1 + v2 * v2;
863 while (r2 > 1.0 || r2 == 0);
865 normal = v1 * std::sqrt (-2.0 * std::log (r2) / r2);
867 x = std::exp (sigma *
normal + mu);
876 return static_cast<uint32_t
> (
GetValue (mu, sigma));
899 .SetGroupName (
"Core")
901 .AddAttribute (
"Alpha",
"The alpha value for the gamma distribution returned by this RNG stream.",
904 MakeDoubleChecker<double>())
905 .AddAttribute (
"Beta",
"The beta value for the gamma distribution returned by this RNG stream.",
908 MakeDoubleChecker<double>())
965 double d =
alpha - 1.0 / 3.0;
966 double c = (1.0 / 3.0) / std::sqrt (d);
975 double variance = 1.0;
989 if (u < 1 - 0.0331 *
x *
x *
x *
x)
993 if (std::log (u) < 0.5 *
x *
x + d * (1 - v + std::log (v)))
1029 double x2 = mean +
m_v2 *
m_y * std::sqrt (variance);
1030 if (std::fabs (x2 - mean) <= bound)
1046 double v1 = 2 * u1 - 1;
1047 double v2 = 2 * u2 - 1;
1048 double w = v1 * v1 + v2 * v2;
1051 double y = std::sqrt ((-2 * std::log (w)) / w);
1052 double x1 = mean + v1 * y * std::sqrt (variance);
1054 if (std::fabs (x1 - mean) <= bound)
1062 double x2 = mean + v2 * y * std::sqrt (variance);
1063 if (std::fabs (x2 - mean) <= bound)
1078 static TypeId tid =
TypeId (
"ns3::ErlangRandomVariable")
1080 .SetGroupName (
"Core")
1082 .AddAttribute (
"K",
"The k value for the Erlang distribution returned by this RNG stream.",
1085 MakeIntegerChecker<uint32_t>())
1086 .AddAttribute (
"Lambda",
"The lambda value for the Erlang distribution returned by this RNG stream.",
1089 MakeDoubleChecker<double>())
1128 double mean = lambda;
1132 for (
unsigned int i = 0; i <
k; ++i)
1145 return static_cast<uint32_t
> (
GetValue (
k, lambda));
1175 double r = -mean*std::log (v);
1178 if (bound == 0 || r <= bound)
1190 static TypeId tid =
TypeId (
"ns3::TriangularRandomVariable")
1192 .SetGroupName (
"Core")
1194 .AddAttribute (
"Mean",
"The mean value for the triangular distribution returned by this RNG stream.",
1197 MakeDoubleChecker<double>())
1198 .AddAttribute (
"Min",
"The lower bound on the values returned by this RNG stream.",
1201 MakeDoubleChecker<double>())
1202 .AddAttribute (
"Max",
"The upper bound on the values returned by this RNG stream.",
1205 MakeDoubleChecker<double>())
1240 double mode = 3.0 * mean -
min -
max;
1252 return min + std::sqrt (u * (
max -
min) * (mode -
min) );
1256 return max - std::sqrt ( (1 - u) * (
max -
min) * (
max - mode) );
1287 .SetGroupName (
"Core")
1289 .AddAttribute (
"N",
"The n value for the Zipf distribution returned by this RNG stream.",
1292 MakeIntegerChecker<uint32_t>())
1293 .AddAttribute (
"Alpha",
"The alpha value for the Zipf distribution returned by this RNG stream.",
1296 MakeDoubleChecker<double>())
1325 for (uint32_t i = 1; i <=
n; i++)
1327 m_c += (1.0 / std::pow ((
double)i,
alpha));
1338 double sum_prob = 0,zipf_value = 0;
1339 for (uint32_t i = 1; i <=
m_n; i++)
1341 sum_prob +=
m_c / std::pow ((
double)i,
m_alpha);
1378 .SetGroupName (
"Core")
1380 .AddAttribute (
"Alpha",
"The alpha value for the zeta distribution returned by this RNG stream.",
1383 MakeDoubleChecker<double>())
1426 X = std::floor (std::pow (u, -1.0 / (
m_alpha - 1.0)));
1427 T = std::pow (1.0 + 1.0 / X,
m_alpha - 1.0);
1428 test = v * X * (T - 1.0) / (
m_b - 1.0);
1430 while ( test > (T /
m_b) );
1460 static TypeId tid =
TypeId (
"ns3::DeterministicRandomVariable")
1462 .SetGroupName (
"Core")
1496 m_data =
new double[length];
1501 for (std::size_t i = 0; i <
m_count; i++)
1556 static TypeId tid =
TypeId (
"ns3::EmpiricalRandomVariable")
1558 .SetGroupName (
"Core")
1560 .AddAttribute (
"Interpolate",
1561 "Treat the CDF as a smooth distribution and interpolate, "
1562 "default is to treat the CDF as a histogram and sample.",
1588 return static_cast<uint32_t
> (
GetValue ());
1611 if (r <=
m_emp.front ().cdf)
1613 value =
m_emp.front ().value;
1616 else if (r >=
m_emp.back ().cdf)
1618 value =
m_emp.back ().value;
1653 auto bound = std::upper_bound (
m_emp.begin (),
m_emp.end (), selector);
1655 return bound->value;
1684 auto upper = std::upper_bound (
m_emp.begin (),
m_emp.end (), selector);
1686 if (upper ==
m_emp.begin ())
1692 double c1 = lower->cdf;
1693 double c2 = upper->cdf;
1694 double v1 = lower->value;
1695 double v2 = upper->value;
1697 double value = (v1 + ((v2 - v1) / (c2 - c1)) * (r - c1));
1719 for (
auto current :
m_emp)
1721 if (current.value < prior.
value || current.cdf < prior.
cdf)
1723 std::cerr <<
"Empirical Dist error,"
1724 <<
" current value " << current.value
1725 <<
" prior value " << prior.
value
1726 <<
" current cdf " << current.cdf
1727 <<
" prior cdf " << prior.
cdf << std::endl;
1732 if (prior.
cdf != 1.0)
NS_ASSERT() and NS_ASSERT_MSG() macro definitions.
ns3::BooleanValue attribute value declarations.
AttributeValue implementation for Boolean.
The Random Number Generator (RNG) that returns a constant.
ConstantRandomVariable()
Creates a constant RNG with the default constant value.
virtual double GetValue(void)
Get the next random value as a double drawn from the distribution.
double m_constant
The constant value returned by this RNG stream.
static TypeId GetTypeId(void)
Register this type.
virtual uint32_t GetInteger(void)
Get the next random value as an integer drawn from the distribution.
double GetConstant(void) const
Get the constant value returned by this RNG stream.
The Random Number Generator (RNG) that returns a predetermined sequence.
std::size_t m_next
Position of the next value in the array of values.
virtual ~DeterministicRandomVariable()
static TypeId GetTypeId(void)
Register this type.
virtual double GetValue(void)
Returns the next value in the sequence.
double * m_data
Array of values to return in sequence.
DeterministicRandomVariable()
Creates a deterministic RNG that will have a predetermined sequence of values.
void SetValueArray(double *values, std::size_t length)
Sets the array of values that holds the predetermined sequence.
virtual uint32_t GetInteger(void)
Returns the next value in the sequence.
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'.
Helper to hold one point of the CDF.
double value
The argument value.
ValueCDF(void)
Constructor.
double cdf
The CDF at value
The Random Number Generator (RNG) that has a specified empirical distribution.
bool SetInterpolate(bool interpolate)
Switch the mode between sampling the CDF and interpolating.
virtual double Interpolate(void)
Returns the next value in the empirical distribution using linear interpolation.
virtual double GetValue(void)
Returns the next value in the empirical distribution.
void CDF(double v, double c)
Specifies a point in the empirical distribution.
EmpiricalRandomVariable(void)
Creates an empirical RNG that has a specified, empirical distribution, and configured for interpolati...
virtual uint32_t GetInteger(void)
Returns the next value in the empirical distribution.
void Validate(void)
Check that the CDF is valid.
bool PreSample(double &value)
Do the initial rng draw and check against the extrema.
static TypeId GetTypeId(void)
Register this type.
double DoSampleCDF(double r)
Sample the CDF as a histogram (without interpolation).
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.
std::vector< ValueCDF > m_emp
The vector of CDF points.
friend bool operator<(ValueCDF a, ValueCDF b)
Comparison operator, for use by std::upper_bound.
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.
static TypeId GetTypeId(void)
Register this type.
double GetExponentialValue(double mean, double bound)
Returns a random double from an exponential distribution with the specified mean and upper bound.
double GetLambda(void) const
Returns the lambda value for the Erlang distribution returned by this RNG stream.
virtual double GetValue(void)
Returns a random double from an Erlang distribution with the current k and lambda.
uint32_t GetK(void) const
Returns the k value for the Erlang distribution returned by this RNG stream.
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from an Erlang distribution with the current k and lambda.
uint32_t m_k
The k value for the Erlang distribution returned by this RNG stream.
ErlangRandomVariable()
Creates an Erlang distribution RNG with the default values for k and lambda.
The exponential distribution Random Number Generator (RNG).
double GetBound(void) const
Get the configured upper bound of this RNG.
ExponentialRandomVariable()
Creates an exponential distribution RNG with the default values for the mean and upper bound.
double GetMean(void) const
Get the configured mean value of this RNG.
double m_mean
The mean value of the unbounded exponential distribution.
double m_bound
The upper bound on values that can be returned by this RNG stream.
virtual double GetValue(void)
Get the next random value as a double drawn from the distribution.
static TypeId GetTypeId(void)
Register this type.
virtual uint32_t GetInteger(void)
Get the next random value as an integer drawn from the distribution.
The gamma distribution Random Number Generator (RNG) that allows stream numbers to be set determinist...
double GetBeta(void) const
Returns the beta value for the gamma distribution returned by this RNG stream.
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a gamma distribution with the current alpha and beta.
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.
virtual double GetValue(void)
Returns a random double from a gamma distribution with the current alpha and beta.
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.
static TypeId GetTypeId(void)
Register this type.
double m_v2
The algorithm produces two values at a time.
bool m_nextValid
True if the next normal value is valid.
double GetAlpha(void) const
Returns the alpha 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...
virtual double GetValue(void)
Returns a random double from a log-normal distribution with the current mu and sigma.
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 GetSigma(void) const
Returns the sigma value for the log-normal distribution returned by this RNG stream.
double GetMu(void) const
Returns the mu value for the log-normal distribution returned by this RNG stream.
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a log-normal distribution with the current mu and sigma.
static TypeId GetTypeId(void)
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 GetVariance(void) const
Returns the variance value for the normal distribution returned by this RNG stream.
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a normal distribution with the current mean,...
static TypeId GetTypeId(void)
Register this type.
double m_mean
The mean value for the normal distribution returned by this RNG stream.
double GetBound(void) const
Returns the bound on values that can be returned by this RNG stream.
static const double INFINITE_VALUE
Large constant to bound the range.
double GetMean(void) const
Returns the mean value for the normal distribution returned by this RNG stream.
double m_variance
The variance value for the normal distribution returned by this RNG stream.
virtual double GetValue(void)
Returns a random double from a normal distribution with the current mean, variance,...
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 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,...
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a Pareto distribution with the current mean,...
double GetShape(void) const
Returns the shape parameter for the Pareto distribution returned by this RNG stream.
double m_shape
The shape parameter for the Pareto distribution returned by this RNG stream.
static TypeId GetTypeId(void)
Register this type.
double m_mean
The mean 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.
double GetBound(void) const
Returns the upper bound on values that can be returned by this RNG stream.
double GetScale(void) const
Returns the scale parameter for the Pareto distribution returned by this RNG stream.
virtual double GetValue(void)
Returns a random double from a Pareto distribution with the current mean, shape, and upper bound.
The basic uniform Random Number Generator (RNG).
static TypeId GetTypeId(void)
Register this type.
virtual ~RandomVariableStream()
Destructor.
virtual double GetValue(void)=0
Get the next random value as a double drawn from the distribution.
RngStream * Peek(void) const
Get the pointer to the underlying RngStream.
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.
RngStream * m_rng
Pointer to the underlying RngStream.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
int64_t GetStream(void) const
Returns the stream number for the RngStream.
bool IsAntithetic(void) const
Check if antithetic values will be generated.
static uint32_t GetSeed(void)
Get the current seed value which will be used by all subsequently instantiated RandomVariableStream o...
static uint64_t GetNextStreamIndex(void)
Get the next automatically assigned stream index.
static uint64_t GetRun(void)
Get the current run number.
Combined Multiple-Recursive Generator MRG32k3a.
double RandU01(void)
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.
static TypeId GetTypeId(void)
Register this type.
double m_min
The first value of the sequence.
uint32_t m_consecutive
The number of times each distinct value is repeated.
virtual double GetValue(void)
Get the next random value as a double drawn from the distribution.
Ptr< RandomVariableStream > GetIncrement(void) const
Get the increment for the sequence.
double GetMax(void) const
Get the limit of the sequence, which is (at least) one more than the last value of the sequence.
double m_current
The current sequence value.
double GetMin(void) const
Get the first value of the sequence.
double m_max
Strict upper bound on the sequence.
virtual uint32_t GetInteger(void)
Get the next random value as an integer drawn from the distribution.
Ptr< RandomVariableStream > m_increment
Increment between distinct values.
uint32_t GetConsecutive(void) const
Get the number of times each distinct value of the sequence is repeated before incrementing to the ne...
SequentialRandomVariable()
Creates a sequential RNG with the default values for the sequence parameters.
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 GetMin(void) const
Returns the lower bound for the triangular distribution returned by this RNG stream.
virtual double GetValue(void)
Returns a random double from a triangular distribution with the current mean, min,...
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a triangular distribution with the current mean,...
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.
static TypeId GetTypeId(void)
Register this type.
TriangularRandomVariable()
Creates a triangular distribution RNG with the default values for the mean, lower bound,...
double m_min
The lower bound on values that can be returned by this RNG stream.
double GetMax(void) const
Returns the upper bound on values that can be returned by this RNG stream.
double GetMean(void) const
Returns the mean value for the triangular distribution returned by this RNG stream.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
@ DEPRECATED
Attribute or trace source is deprecated; user is warned.
The Weibull distribution Random Number Generator (RNG) that allows stream numbers to be set determini...
virtual double GetValue(void)
Returns a random double from a Weibull distribution with the current scale, shape,...
double m_shape
The shape parameter for the Weibull distribution returned by this RNG stream.
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a Weibull distribution with the current scale,...
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(void) const
Returns the upper bound on values that can be returned by this RNG stream.
WeibullRandomVariable()
Creates a Weibull distribution RNG with the default values for the scale, shape, and upper bound.
double GetScale(void) const
Returns the scale parameter for the Weibull distribution returned by this RNG stream.
double GetShape(void) const
Returns the shape parameter for the Weibull distribution returned by this RNG stream.
static TypeId GetTypeId(void)
Register this type.
The zeta distribution Random Number Generator (RNG) that allows stream numbers to be set deterministi...
double GetAlpha(void) const
Returns the alpha value for the zeta distribution returned by this RNG stream.
double m_alpha
The alpha value for the zeta distribution returned by this RNG stream.
static TypeId GetTypeId(void)
Register this type.
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a zeta distribution with the current alpha.
ZetaRandomVariable()
Creates a zeta distribution RNG with the default value for alpha.
virtual double GetValue(void)
Returns a random double from a zeta distribution with the current alpha.
double m_b
Just for calculus simplifications.
The Zipf distribution Random Number Generator (RNG) that allows stream numbers to be set deterministi...
double GetAlpha(void) const
Returns the alpha value for the Zipf distribution returned by this RNG stream.
virtual double GetValue(void)
Returns a random double from a Zipf distribution with the current n and alpha.
double m_c
The normalization constant.
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.
static TypeId GetTypeId(void)
Register this type.
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a Zipf distribution with the current n and alpha.
uint32_t GetN(void) const
Returns the n value for the Zipf distribution returned by this RNG stream.
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 AttributeChecker > MakeBooleanChecker(void)
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_UNUSED(x)
Mark a local variable as unused.
#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_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.
double max(double x, double y)
double min(double x, double y)
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.
NS_UNUSED and NS_UNUSED_GLOBAL macro definitions.