|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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 (
"Scale",
"The scale parameter for the Pareto distribution returned by this RNG stream.",
461 MakeDoubleChecker<double>())
462 .AddAttribute (
"Shape",
"The shape parameter for the Pareto distribution returned by this RNG stream.",
465 MakeDoubleChecker<double>())
466 .AddAttribute (
"Bound",
"The upper bound on the values returned by this RNG stream (if non-zero).",
469 MakeDoubleChecker<double>())
517 double r = (scale * ( 1.0 / std::pow (v, 1.0 / shape)));
520 if (bound == 0 || r <= bound)
530 return static_cast<uint32_t
> (
GetValue (scale, shape, bound) );
551 static TypeId tid =
TypeId (
"ns3::WeibullRandomVariable")
553 .SetGroupName (
"Core")
555 .AddAttribute (
"Scale",
"The scale parameter for the Weibull distribution returned by this RNG stream.",
558 MakeDoubleChecker<double>())
559 .AddAttribute (
"Shape",
"The shape parameter for the Weibull distribution returned by this RNG stream.",
562 MakeDoubleChecker<double>())
563 .AddAttribute (
"Bound",
"The upper bound on the values returned by this RNG stream.",
566 MakeDoubleChecker<double>())
600 double exponent = 1.0 / shape;
611 double r = scale * std::pow ( -std::log (v), exponent);
614 if (bound == 0 || r <= bound)
624 return static_cast<uint32_t
> (
GetValue (scale, shape, bound) );
647 static TypeId tid =
TypeId (
"ns3::NormalRandomVariable")
649 .SetGroupName (
"Core")
651 .AddAttribute (
"Mean",
"The mean value for the normal distribution returned by this RNG stream.",
654 MakeDoubleChecker<double>())
655 .AddAttribute (
"Variance",
"The variance value for the normal distribution returned by this RNG stream.",
658 MakeDoubleChecker<double>())
659 .AddAttribute (
"Bound",
"The bound on the values returned by this RNG stream.",
662 MakeDoubleChecker<double>())
701 double x2 = mean +
m_v2 *
m_y * std::sqrt (variance);
702 if (std::fabs (x2 - mean) <= bound)
718 double v1 = 2 * u1 - 1;
719 double v2 = 2 * u2 - 1;
720 double w = v1 * v1 + v2 * v2;
723 double y = std::sqrt ((-2 * std::log (w)) / w);
724 double x1 = mean + v1 * y * std::sqrt (variance);
726 if (std::fabs (x1 - mean) <= bound)
734 double x2 = mean + v2 * y * std::sqrt (variance);
735 if (std::fabs (x2 - mean) <= bound)
749 return static_cast<uint32_t
> (
GetValue (mean, variance, bound) );
770 static TypeId tid =
TypeId (
"ns3::LogNormalRandomVariable")
772 .SetGroupName (
"Core")
774 .AddAttribute (
"Mu",
"The mu value for the log-normal distribution returned by this RNG stream.",
777 MakeDoubleChecker<double>())
778 .AddAttribute (
"Sigma",
"The sigma value for the log-normal distribution returned by this RNG stream.",
781 MakeDoubleChecker<double>())
854 r2 = v1 * v1 + v2 * v2;
856 while (r2 > 1.0 || r2 == 0);
858 normal = v1 * std::sqrt (-2.0 * std::log (r2) / r2);
860 x = std::exp (sigma *
normal + mu);
869 return static_cast<uint32_t
> (
GetValue (mu, sigma));
892 .SetGroupName (
"Core")
894 .AddAttribute (
"Alpha",
"The alpha value for the gamma distribution returned by this RNG stream.",
897 MakeDoubleChecker<double>())
898 .AddAttribute (
"Beta",
"The beta value for the gamma distribution returned by this RNG stream.",
901 MakeDoubleChecker<double>())
958 double d =
alpha - 1.0 / 3.0;
959 double c = (1.0 / 3.0) / std::sqrt (d);
968 double variance = 1.0;
982 if (u < 1 - 0.0331 *
x *
x *
x *
x)
986 if (std::log (u) < 0.5 *
x *
x + d * (1 - v + std::log (v)))
1022 double x2 = mean +
m_v2 *
m_y * std::sqrt (variance);
1023 if (std::fabs (x2 - mean) <= bound)
1039 double v1 = 2 * u1 - 1;
1040 double v2 = 2 * u2 - 1;
1041 double w = v1 * v1 + v2 * v2;
1044 double y = std::sqrt ((-2 * std::log (w)) / w);
1045 double x1 = mean + v1 * y * std::sqrt (variance);
1047 if (std::fabs (x1 - mean) <= bound)
1055 double x2 = mean + v2 * y * std::sqrt (variance);
1056 if (std::fabs (x2 - mean) <= bound)
1071 static TypeId tid =
TypeId (
"ns3::ErlangRandomVariable")
1073 .SetGroupName (
"Core")
1075 .AddAttribute (
"K",
"The k value for the Erlang distribution returned by this RNG stream.",
1078 MakeIntegerChecker<uint32_t>())
1079 .AddAttribute (
"Lambda",
"The lambda value for the Erlang distribution returned by this RNG stream.",
1082 MakeDoubleChecker<double>())
1121 double mean = lambda;
1125 for (
unsigned int i = 0; i <
k; ++i)
1138 return static_cast<uint32_t
> (
GetValue (
k, lambda));
1168 double r = -mean*std::log (v);
1171 if (bound == 0 || r <= bound)
1183 static TypeId tid =
TypeId (
"ns3::TriangularRandomVariable")
1185 .SetGroupName (
"Core")
1187 .AddAttribute (
"Mean",
"The mean value for the triangular distribution returned by this RNG stream.",
1190 MakeDoubleChecker<double>())
1191 .AddAttribute (
"Min",
"The lower bound on the values returned by this RNG stream.",
1194 MakeDoubleChecker<double>())
1195 .AddAttribute (
"Max",
"The upper bound on the values returned by this RNG stream.",
1198 MakeDoubleChecker<double>())
1233 double mode = 3.0 * mean -
min -
max;
1245 return min + std::sqrt (u * (
max -
min) * (mode -
min) );
1249 return max - std::sqrt ( (1 - u) * (
max -
min) * (
max - mode) );
1280 .SetGroupName (
"Core")
1282 .AddAttribute (
"N",
"The n value for the Zipf distribution returned by this RNG stream.",
1285 MakeIntegerChecker<uint32_t>())
1286 .AddAttribute (
"Alpha",
"The alpha value for the Zipf distribution returned by this RNG stream.",
1289 MakeDoubleChecker<double>())
1318 for (uint32_t i = 1; i <=
n; i++)
1320 m_c += (1.0 / std::pow ((
double)i,
alpha));
1331 double sum_prob = 0,zipf_value = 0;
1332 for (uint32_t i = 1; i <=
m_n; i++)
1334 sum_prob +=
m_c / std::pow ((
double)i,
m_alpha);
1371 .SetGroupName (
"Core")
1373 .AddAttribute (
"Alpha",
"The alpha value for the zeta distribution returned by this RNG stream.",
1376 MakeDoubleChecker<double>())
1419 X = std::floor (std::pow (u, -1.0 / (
m_alpha - 1.0)));
1420 T = std::pow (1.0 + 1.0 / X,
m_alpha - 1.0);
1421 test = v * X * (T - 1.0) / (
m_b - 1.0);
1423 while ( test > (T /
m_b) );
1453 static TypeId tid =
TypeId (
"ns3::DeterministicRandomVariable")
1455 .SetGroupName (
"Core")
1489 m_data =
new double[length];
1494 for (std::size_t i = 0; i <
m_count; i++)
1549 static TypeId tid =
TypeId (
"ns3::EmpiricalRandomVariable")
1551 .SetGroupName (
"Core")
1553 .AddAttribute (
"Interpolate",
1554 "Treat the CDF as a smooth distribution and interpolate, "
1555 "default is to treat the CDF as a histogram and sample.",
1581 return static_cast<uint32_t
> (
GetValue ());
1604 if (r <=
m_emp.front ().cdf)
1606 value =
m_emp.front ().value;
1609 else if (r >=
m_emp.back ().cdf)
1611 value =
m_emp.back ().value;
1646 auto bound = std::upper_bound (
m_emp.begin (),
m_emp.end (), selector);
1648 return bound->value;
1677 auto upper = std::upper_bound (
m_emp.begin (),
m_emp.end (), selector);
1679 if (upper ==
m_emp.begin ())
1685 double c1 = lower->cdf;
1686 double c2 = upper->cdf;
1687 double v1 = lower->value;
1688 double v2 = upper->value;
1690 double value = (v1 + ((v2 - v1) / (c2 - c1)) * (r - c1));
1712 for (
auto current :
m_emp)
1714 if (current.value < prior.
value || current.cdf < prior.
cdf)
1716 std::cerr <<
"Empirical Dist error,"
1717 <<
" current value " << current.value
1718 <<
" prior value " << prior.
value
1719 <<
" current cdf " << current.cdf
1720 <<
" prior cdf " << prior.
cdf << std::endl;
1725 if (prior.
cdf != 1.0)
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
double m_max
Strict upper bound on the sequence.
virtual double GetValue(void)
Get the next random value as a double drawn from the distribution.
uint32_t GetConsecutive(void) const
Get the number of times each distinct value of the sequence is repeated before incrementing to the ne...
std::size_t m_next
Position of the next value in the array of values.
double m_c
The normalization constant.
virtual double GetValue(void)
Returns a random double from an Erlang distribution with the current k and lambda.
static TypeId GetTypeId(void)
Register this type.
ns3::RngSeedManager declaration.
double GetScale(void) const
Returns the scale parameter for the Pareto distribution returned by this RNG stream.
bool m_nextValid
True if the next value is valid.
void SetAntithetic(bool isAntithetic)
Specify whether antithetic values should be generated.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
double GetShape(void) const
Returns the shape parameter for the Weibull distribution returned by this RNG stream.
AttributeValue implementation for Boolean.
double DoSampleCDF(double r)
Sample the CDF as a histogram (without interpolation).
double GetMax(void) const
Get the limit of the sequence, which is (at least) one more than the last value of the sequence.
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
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 Pareto distribution with the current mean, shape, and upper bound.
double GetNormalValue(double mean, double variance, double bound)
Returns a random double from a normal distribution with the specified mean, variance,...
double m_bound
The bound on values that can be returned by this RNG stream.
virtual double GetValue(void)
Returns a random double from a zeta distribution with the current alpha.
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from an Erlang distribution with the current k and lambda.
virtual double Interpolate(void)
Returns the next value in the empirical distribution using linear interpolation.
The triangular distribution Random Number Generator (RNG) that allows stream numbers to be set determ...
ns3::DoubleValue attribute value declarations and template implementations.
ExponentialRandomVariable()
Creates an exponential distribution RNG with the default values for the mean and upper bound.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::BooleanValue attribute value declarations.
double GetBound(void) const
Get the configured upper bound of this RNG.
virtual double GetValue(void)
Returns a random double from a triangular distribution with the current mean, min,...
double GetSigma(void) const
Returns the sigma value for the log-normal distribution returned by this RNG stream.
double m_max
The upper bound on values that can be returned by this RNG stream.
Hold a signed integer type.
RngStream * Peek(void) const
Get the pointer to the underlying RngStream.
double GetAlpha(void) const
Returns the alpha value for the zeta distribution returned by this RNG stream.
virtual double GetValue(void)
Returns the next value in the sequence.
double m_y
The algorithm produces two values at a time.
ns3::StringValue attribute value declarations.
double GetMu(void) const
Returns the mu value for the log-normal distribution returned by this RNG stream.
RandomVariableStream()
Default constructor.
ParetoRandomVariable()
Creates a Pareto distribution RNG with the default values for the mean, the shape,...
double m_y
The algorithm produces two values at a time.
double m_alpha
The alpha value for the Zipf distribution returned by this RNG stream.
virtual uint32_t GetInteger(void)
Get the next random value as an integer drawn from the distribution.
double m_beta
The beta value for the gamma distribution returned by this RNG stream.
DeterministicRandomVariable()
Creates a deterministic RNG that will have a predetermined sequence of values.
double GetVariance(void) const
Returns the variance value for the normal distribution returned by this RNG stream.
bool PreSample(double &value)
Do the initial rng draw and check against the extrema.
double RandU01(void)
Generate the next random number for this stream.
double m_mean
The mean value for the normal distribution returned by this RNG stream.
NS_ASSERT() and NS_ASSERT_MSG() macro definitions.
static TypeId GetTypeId(void)
Register this type.
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a log-normal distribution with the current mu and sigma.
ns3::RandomVariableStream declaration, and related classes.
static uint64_t GetNextStreamIndex(void)
Get the next automatically assigned stream index.
double GetConstant(void) const
Get the constant value returned by this RNG stream.
Helper to hold one point of the CDF.
uint32_t m_consecutive
The number of times each distinct value is repeated.
NS_UNUSED and NS_UNUSED_GLOBAL macro definitions.
virtual uint32_t GetInteger(void)
Get the next random value as an integer drawn from the distribution.
uint32_t m_n
The n value for the Zipf distribution returned by this RNG stream.
double GetLambda(void) const
Returns the lambda value for the Erlang distribution returned by this RNG stream.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
bool IsAntithetic(void) const
Check if antithetic values will be generated.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
double m_current
The current sequence value.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
double cdf
The CDF at value
bool m_isAntithetic
Indicates if antithetic values should be generated by this RNG stream.
static uint64_t GetRun(void)
Get the current run number.
double m_mu
The mu value for the log-normal distribution returned by this RNG stream.
void Validate(void)
Check that the CDF is valid.
The log-normal distribution Random Number Generator (RNG) that allows stream numbers to be set determ...
void SetValueArray(double *values, std::size_t length)
Sets the array of values that holds the predetermined sequence.
bool m_interpolate
If true GetValue will interpolate, otherwise treat CDF as normal histogram.
virtual uint32_t GetInteger(void)
Returns the next value in the empirical distribution.
The Erlang distribution Random Number Generator (RNG) that allows stream numbers to be set determinis...
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 normal distribution with the current mean,...
TriangularRandomVariable()
Creates a triangular distribution RNG with the default values for the mean, lower bound,...
double GetBeta(void) const
Returns the beta value for the gamma distribution returned by this RNG stream.
double m_constant
The constant value 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.
The zeta distribution Random Number Generator (RNG) that allows stream numbers to be set deterministi...
virtual uint32_t GetInteger(void)
Get the next random value as an integer drawn from the distribution.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
double m_alpha
The alpha value for the zeta distribution returned by this RNG stream.
double min(double x, double y)
double m_lambda
The lambda value for the Erlang distribution returned by this RNG stream.
The Pareto distribution Random Number Generator (RNG).
static TypeId GetTypeId(void)
Register this type.
double m_min
The lower bound on values that can be returned by this RNG stream.
A base class which provides memory management and object aggregation.
The Random Number Generator (RNG) that returns a constant.
double * m_data
Array of values to return in sequence.
static TypeId GetTypeId(void)
Register this type.
The Weibull distribution Random Number Generator (RNG) that allows stream numbers to be set determini...
uint32_t GetK(void) const
Returns the k value for the Erlang distribution returned by this RNG stream.
ns3::PointerValue attribute value declarations and template implementations.
static const double INFINITE_VALUE
Large constant to bound the range.
int64_t m_stream
The stream number for the RngStream.
double GetMean(void) const
Get the configured mean value of this RNG.
static TypeId GetTypeId(void)
Register this type.
double GetMean(void) const
Returns the mean value for the triangular distribution returned by this RNG stream.
GammaRandomVariable()
Creates a gamma distribution RNG with the default values for alpha and beta.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
ErlangRandomVariable()
Creates an Erlang distribution RNG with the default values for k and lambda.
virtual double GetValue(void)
Returns a random double from a Zipf distribution with the current n and alpha.
virtual double GetValue(void)
Returns a random double from a gamma distribution with the current alpha and beta.
static TypeId GetTypeId(void)
Register this type.
double m_scale
The scale parameter for the Pareto distribution returned by this RNG stream.
The Random Number Generator (RNG) that has a specified empirical distribution.
EmpiricalRandomVariable(void)
Creates an empirical RNG that has a specified, empirical distribution, and configured for interpolati...
double m_min
The first value of the sequence.
virtual double GetValue(void)
Get the next random value as a double drawn from the distribution.
void CDF(double v, double c)
Specifies a point in the empirical distribution.
friend bool operator<(ValueCDF a, ValueCDF b)
Comparison operator, for use by std::upper_bound.
WeibullRandomVariable()
Creates a Weibull distribution RNG with the default values for the scale, shape, and upper bound.
ns3::RngStream declaration.
static TypeId GetTypeId(void)
Register this type.
double GetMax(void) const
Returns the upper bound on values that can be returned by this RNG stream.
static TypeId GetTypeId(void)
Register this type.
virtual double GetValue(void)
Returns a random double from a normal distribution with the current mean, variance,...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Hold variables of type string.
double GetAlpha(void) const
Returns the alpha value for the Zipf distribution returned by this RNG stream.
virtual ~DeterministicRandomVariable()
LogNormalRandomVariable()
Creates a log-normal distribution RNG with the default values for mu and sigma.
The Random Number Generator (RNG) that returns a predetermined sequence.
Combined Multiple-Recursive Generator MRG32k3a.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a Zipf distribution with the current n and alpha.
double m_mean
The mean value of the unbounded exponential distribution.
double m_v2
The algorithm produces two values at a time.
double GetShape(void) const
Returns the shape parameter for the Pareto distribution returned by this RNG stream.
ZetaRandomVariable()
Creates a zeta distribution RNG with the default value for alpha.
double m_bound
The upper bound on values that can be returned by this RNG stream.
double m_mean
The mean value for the triangular distribution returned by this RNG stream.
The Zipf distribution Random Number Generator (RNG) that allows stream numbers to be set deterministi...
virtual double GetValue(void)
Get the next random value as a double drawn from the distribution.
static TypeId GetTypeId(void)
Register this type.
double GetBound(void) const
Returns 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.
ConstantRandomVariable()
Creates a constant RNG with the default constant value.
Ptr< RandomVariableStream > GetIncrement(void) const
Get the increment for the sequence.
bool m_validated
true once the CDF has been validated.
SequentialRandomVariable()
Creates a sequential RNG with the default values for the sequence parameters.
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.
Ptr< RandomVariableStream > m_increment
Increment between distinct values.
double m_variance
The variance value for the normal distribution returned by this RNG stream.
virtual double GetValue(void)=0
Get the next random value as a double drawn from the distribution.
The normal (Gaussian) distribution Random Number Generator (RNG) that allows stream numbers to be set...
The gamma distribution Random Number Generator (RNG) that allows stream numbers to be set determinist...
ValueCDF(void)
Constructor.
virtual double GetValue(void)
Returns a random double from a log-normal distribution with the current mu and sigma.
double m_shape
The shape parameter for the Pareto distribution returned by this RNG stream.
double GetBound(void) const
Returns the upper bound on values that can be returned by this RNG stream.
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a Pareto distribution with the current mean,...
double GetMin(void) const
Get the first value of the sequence.
static TypeId GetTypeId(void)
Register this type.
uint32_t m_k
The k value for the Erlang distribution returned by this RNG stream.
virtual double GetValue(void)
Returns a random double from a Weibull distribution with the current scale, shape,...
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
bool m_isCurrentSet
Indicates if the current sequence value has been properly initialized.
virtual uint32_t GetInteger(void)
Returns the next value in the sequence.
The Random Number Generator (RNG) that returns a pattern of sequential values.
double GetExponentialValue(double mean, double bound)
Returns a random double from an exponential distribution with the specified mean and upper bound.
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a triangular distribution with the current mean,...
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static TypeId GetTypeId(void)
Register this type.
double DoInterpolate(double r)
Linear interpolation between two points on the CDF to estimate the value at r.
static TypeId GetTypeId(void)
Register this type.
double max(double x, double y)
double GetScale(void) const
Returns the scale parameter for the Weibull distribution returned by this RNG stream.
static uint32_t GetSeed(void)
Get the current seed value which will be used by all subsequently instantiated RandomVariableStream o...
virtual ~RandomVariableStream()
Destructor.
NormalRandomVariable()
Creates a normal distribution RNG with the default values for the mean, variance, and bound.
double m_bound
The upper bound on values that can be returned by this RNG stream.
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a zeta distribution with the current alpha.
bool m_nextValid
True if the next normal value is valid.
The exponential distribution Random Number Generator (RNG).
double GetMean(void) const
Returns the mean value for the normal distribution returned by this RNG stream.
The basic uniform Random Number Generator (RNG).
RngStream * m_rng
Pointer to the underlying RngStream.
double value
The argument value.
double GetBound(void) const
Returns the bound on values that can be returned by this RNG stream.
double GetMin(void) const
Returns the lower bound for the triangular distribution returned by this RNG stream.
double m_b
Just for calculus simplifications.
static TypeId GetTypeId(void)
Register this type.
bool SetInterpolate(bool interpolate)
Switch the mode between sampling the CDF and interpolating.
uint32_t GetN(void) const
Returns the n value for the Zipf distribution returned by this RNG stream.
std::size_t m_count
Size of the array of values.
ns3::IntegerValue attribute value declarations and template implementations.
double m_v2
The algorithm produces two values at a time.
int64_t GetStream(void) const
Returns the stream number for the RngStream.
ZipfRandomVariable()
Creates a Zipf distribution RNG with the default values for n and alpha.
uint32_t m_currentConsecutive
The number of times the current distinct value has been repeated.
static TypeId GetTypeId(void)
Register this type.
std::vector< ValueCDF > m_emp
The vector of CDF points.
static TypeId GetTypeId(void)
Register this type.
virtual double GetValue(void)
Returns the next value in the empirical distribution.
double GetAlpha(void) const
Returns the alpha value for the gamma distribution returned by this RNG stream.
double m_sigma
The sigma value for the log-normal distribution returned by this RNG stream.