A Discrete-Event Network Simulator
API
random-variable-stream.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006 Georgia Tech Research Corporation
4  * Copyright (c) 2011 Mathieu Lacage
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Rajib Bhattacharjea<raj.b@gatech.edu>
20  * Hadi Arbabi<marbabi@cs.odu.edu>
21  * Mathieu Lacage <mathieu.lacage@gmail.com>
22  *
23  * Modified by Mitch Watrous <watrous@u.washington.edu>
24  *
25  */
26 #ifndef RANDOM_VARIABLE_STREAM_H
27 #define RANDOM_VARIABLE_STREAM_H
28 
29 #include "type-id.h"
30 #include "object.h"
31 #include "attribute-helper.h"
32 #include <stdint.h>
33 
40 namespace ns3 {
41 
72 class RngStream;
73 
98 {
99 public:
104  static TypeId GetTypeId (void);
112  virtual ~RandomVariableStream ();
113 
119  void SetStream (int64_t stream);
120 
126  int64_t GetStream (void) const;
127 
132  void SetAntithetic (bool isAntithetic);
133 
138  bool IsAntithetic (void) const;
139 
144  virtual double GetValue (void) = 0;
145 
150  virtual uint32_t GetInteger (void) = 0;
151 
152 protected:
157  RngStream * Peek (void) const;
158 
159 private:
180 
183 
186 
188  int64_t m_stream;
189 
190 }; // class RandomVariableStream
191 
192 
235 {
236 public:
241  static TypeId GetTypeId (void);
242 
247 
252  double GetMin (void) const;
253 
258  double GetMax (void) const;
259 
270  double GetValue (double min, double max);
271 
282  uint32_t GetInteger (uint32_t min, uint32_t max);
283 
284  // Inherited from RandomVariableStream
290  virtual double GetValue (void);
296  virtual uint32_t GetInteger (void);
297 
298 private:
300  double m_min;
301 
303  double m_max;
304 
305 }; // class UniformRandomVariable
306 
307 
319 {
320 public:
325  static TypeId GetTypeId (void);
326 
331 
336  double GetConstant (void) const;
337 
343  double GetValue (double constant);
349  uint32_t GetInteger (uint32_t constant);
350 
351  // Inherited from RandomVariableStream
352  /* \note This RNG always returns the same value. */
353  virtual double GetValue (void);
354  /* \note This RNG always returns the same value. */
355  virtual uint32_t GetInteger (void);
356 
357 private:
359  double m_constant;
360 
361 }; // class ConstantRandomVariable
362 
363 
400 {
401 public:
406  static TypeId GetTypeId (void);
407 
413 
418  double GetMin (void) const;
419 
425  double GetMax (void) const;
426 
432 
438  uint32_t GetConsecutive (void) const;
439 
440  // Inherited from RandomVariableStream
441  virtual double GetValue (void);
442  virtual uint32_t GetInteger (void);
443 
444 private:
446  double m_min;
447 
449  double m_max;
450 
453 
455  uint32_t m_consecutive;
456 
458  double m_current;
459 
462 
465 
466 }; // class SequentialRandomVariable
467 
468 
539 {
540 public:
545  static TypeId GetTypeId (void);
546 
552 
560  double GetMean (void) const;
561 
566  double GetBound (void) const;
567 
575  double GetValue (double mean, double bound);
576 
584  uint32_t GetInteger (uint32_t mean, uint32_t bound);
585 
586  // Inherited from RandomVariableStream
587  virtual double GetValue (void);
588  virtual uint32_t GetInteger (void);
589 
590 private:
592  double m_mean;
593 
595  double m_bound;
596 
597 }; // class ExponentialRandomVariable
598 
599 
641 {
642 public:
647  static TypeId GetTypeId (void);
648 
654 
659  double GetScale (void) const;
660 
665  double GetShape (void) const;
666 
671  double GetBound (void) const;
672 
699  double GetValue (double scale, double shape, double bound);
700 
727  uint32_t GetInteger (uint32_t scale, uint32_t shape, uint32_t bound);
728 
761  virtual double GetValue (void);
762 
786  virtual uint32_t GetInteger (void);
787 
788 private:
790  double m_scale;
791 
793  double m_shape;
794 
796  double m_bound;
797 
798 }; // class ParetoRandomVariable
799 
800 
855 {
856 public:
861  static TypeId GetTypeId (void);
862 
868 
873  double GetScale (void) const;
874 
879  double GetShape (void) const;
880 
885  double GetBound (void) const;
886 
912  double GetValue (double scale, double shape, double bound);
913 
939  uint32_t GetInteger (uint32_t scale, uint32_t shape, uint32_t bound);
940 
968  virtual double GetValue (void);
969 
992  virtual uint32_t GetInteger (void);
993 
994 private:
996  double m_scale;
997 
999  double m_shape;
1000 
1002  double m_bound;
1003 
1004 }; // class WeibullRandomVariable
1005 
1006 
1041 {
1042 public:
1044  static const double INFINITE_VALUE;
1045 
1050  static TypeId GetTypeId (void);
1051 
1057 
1062  double GetMean (void) const;
1063 
1068  double GetVariance (void) const;
1069 
1074  double GetBound (void) const;
1075 
1112  double GetValue (double mean, double variance, double bound = NormalRandomVariable::INFINITE_VALUE);
1113 
1150  uint32_t GetInteger (uint32_t mean, uint32_t variance, uint32_t bound);
1151 
1190  virtual double GetValue (void);
1191 
1225  virtual uint32_t GetInteger (void);
1226 
1227 private:
1229  double m_mean;
1230 
1232  double m_variance;
1233 
1235  double m_bound;
1236 
1239 
1241  double m_v2;
1243  double m_y;
1244 
1245 }; // class NormalRandomVariable
1246 
1247 
1292 {
1293 public:
1298  static TypeId GetTypeId (void);
1299 
1305 
1310  double GetMu (void) const;
1311 
1316  double GetSigma (void) const;
1317 
1351  double GetValue (double mu, double sigma);
1352 
1386  uint32_t GetInteger (uint32_t mu, uint32_t sigma);
1387 
1424  virtual double GetValue (void);
1425 
1457  virtual uint32_t GetInteger (void);
1458 
1459 private:
1461  double m_mu;
1462 
1464  double m_sigma;
1465 
1466 }; // class LogNormalRandomVariable
1467 
1468 
1501 {
1502 public:
1507  static TypeId GetTypeId (void);
1508 
1514 
1519  double GetAlpha (void) const;
1520 
1525  double GetBeta (void) const;
1526 
1540  double GetValue (double alpha, double beta);
1541 
1555  uint32_t GetInteger (uint32_t alpha, uint32_t beta);
1556 
1573  virtual double GetValue (void);
1574 
1586  virtual uint32_t GetInteger (void);
1587 
1588 private:
1625  double GetNormalValue (double mean, double variance, double bound);
1626 
1628  double m_alpha;
1629 
1631  double m_beta;
1632 
1635 
1637  double m_v2;
1639  double m_y;
1640 
1641 }; // class GammaRandomVariable
1642 
1643 
1680 {
1681 public:
1686  static TypeId GetTypeId (void);
1687 
1693 
1698  uint32_t GetK (void) const;
1699 
1704  double GetLambda (void) const;
1705 
1719  double GetValue (uint32_t k, double lambda);
1720 
1734  uint32_t GetInteger (uint32_t k, uint32_t lambda);
1735 
1752  virtual double GetValue (void);
1753 
1765  virtual uint32_t GetInteger (void);
1766 
1767 private:
1792  double GetExponentialValue (double mean, double bound);
1793 
1795  uint32_t m_k;
1796 
1798  double m_lambda;
1799 
1800 }; // class ErlangRandomVariable
1801 
1802 
1832 {
1833 public:
1838  static TypeId GetTypeId (void);
1839 
1845 
1850  double GetMean (void) const;
1851 
1856  double GetMin (void) const;
1857 
1862  double GetMax (void) const;
1863 
1902  double GetValue (double mean, double min, double max);
1903 
1942  uint32_t GetInteger (uint32_t mean, uint32_t min, uint32_t max);
1943 
1984  virtual double GetValue (void);
1985 
2021  virtual uint32_t GetInteger (void);
2022 
2023 private:
2025  double m_mean;
2026 
2028  double m_min;
2029 
2031  double m_max;
2032 
2033 }; // class TriangularRandomVariable
2034 
2035 
2095 {
2096 public:
2101  static TypeId GetTypeId (void);
2102 
2107  ZipfRandomVariable ();
2108 
2113  uint32_t GetN (void) const;
2114 
2119  double GetAlpha (void) const;
2120 
2134  double GetValue (uint32_t n, double alpha);
2135 
2149  uint32_t GetInteger (uint32_t n, uint32_t alpha);
2150 
2167  virtual double GetValue (void);
2168 
2180  virtual uint32_t GetInteger (void);
2181 
2182 private:
2184  uint32_t m_n;
2185 
2187  double m_alpha;
2188 
2190  double m_c;
2191 
2192 }; // class ZipfRandomVariable
2193 
2194 
2235 {
2236 public:
2241  static TypeId GetTypeId (void);
2242 
2247  ZetaRandomVariable ();
2248 
2253  double GetAlpha (void) const;
2254 
2267  double GetValue (double alpha);
2268 
2281  uint32_t GetInteger (uint32_t alpha);
2282 
2299  virtual double GetValue (void);
2300 
2312  virtual uint32_t GetInteger (void);
2313 
2314 private:
2316  double m_alpha;
2317 
2319  double m_b;
2320 
2321 }; // class ZetaRandomVariable
2322 
2323 
2355 {
2356 public:
2361  static TypeId GetTypeId (void);
2362 
2368  virtual ~DeterministicRandomVariable ();
2369 
2378  void SetValueArray (double* values, std::size_t length);
2379 
2384  virtual double GetValue (void);
2385 
2390  virtual uint32_t GetInteger (void);
2391 
2392 private:
2394  std::size_t m_count;
2395 
2397  std::size_t m_next;
2398 
2400  double* m_data;
2401 
2402 }; // class DeterministicRandomVariable
2403 
2404 
2482 {
2483 public:
2488  static TypeId GetTypeId (void);
2489 
2494  EmpiricalRandomVariable (void);
2495 
2503  void CDF (double v, double c); // Value, prob <= Value
2504 
2519  virtual double GetValue (void);
2520 
2534  virtual uint32_t GetInteger (void);
2535 
2542  virtual double Interpolate (void);
2543 
2550  bool SetInterpolate (bool interpolate);
2551 
2552 private:
2554  class ValueCDF
2555  {
2556  public:
2558  ValueCDF (void);
2565  ValueCDF (double v, double c);
2566 
2568  double value;
2570  double cdf;
2571  }; // class ValueCDF
2572 
2583  void Validate (void);
2597  bool PreSample (double & value);
2603  double DoSampleCDF (double r);
2611  double DoInterpolate (double r);
2612 
2619  friend
2620  bool operator < (ValueCDF a, ValueCDF b);
2621 
2625  std::vector<ValueCDF> m_emp;
2631 
2632 }; // class EmpiricalRandomVariable
2633 
2634 
2635 } // namespace ns3
2636 
2637 #endif /* RANDOM_VARIABLE_STREAM_H */
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::SequentialRandomVariable::m_max
double m_max
Strict upper bound on the sequence.
Definition: random-variable-stream.h:449
ns3::ConstantRandomVariable::GetValue
virtual double GetValue(void)
Get the next random value as a double drawn from the distribution.
Definition: random-variable-stream.cc:256
ns3::SequentialRandomVariable::GetConsecutive
uint32_t GetConsecutive(void) const
Get the number of times each distinct value of the sequence is repeated before incrementing to the ne...
Definition: random-variable-stream.cc:328
ns3::DeterministicRandomVariable::m_next
std::size_t m_next
Position of the next value in the array of values.
Definition: random-variable-stream.h:2397
ns3::ZipfRandomVariable::m_c
double m_c
The normalization constant.
Definition: random-variable-stream.h:2190
ns3::ErlangRandomVariable::GetValue
virtual double GetValue(void)
Returns a random double from an Erlang distribution with the current k and lambda.
Definition: random-variable-stream.cc:1142
ns3::ErlangRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:1069
ns3::ParetoRandomVariable::GetScale
double GetScale(void) const
Returns the scale parameter for the Pareto distribution returned by this RNG stream.
Definition: random-variable-stream.cc:481
ns3::NormalRandomVariable::m_nextValid
bool m_nextValid
True if the next value is valid.
Definition: random-variable-stream.h:1238
ns3::RandomVariableStream::SetAntithetic
void SetAntithetic(bool isAntithetic)
Specify whether antithetic values should be generated.
Definition: random-variable-stream.cc:88
ns3::WeibullRandomVariable::GetShape
double GetShape(void) const
Returns the shape parameter for the Weibull distribution returned by this RNG stream.
Definition: random-variable-stream.cc:584
attribute-helper.h
Attribute helper (ATTRIBUTE_ )macros definition.
ns3::EmpiricalRandomVariable::DoSampleCDF
double DoSampleCDF(double r)
Sample the CDF as a histogram (without interpolation).
Definition: random-variable-stream.cc:1641
ns3::SequentialRandomVariable::GetMax
double GetMax(void) const
Get the limit of the sequence, which is (at least) one more than the last value of the sequence.
Definition: random-variable-stream.cc:314
ns3::GammaRandomVariable::m_alpha
double m_alpha
The alpha value for the gamma distribution returned by this RNG stream.
Definition: random-variable-stream.h:1628
ns3::ParetoRandomVariable::GetValue
virtual double GetValue(void)
Returns a random double from a Pareto distribution with the current mean, shape, and upper bound.
Definition: random-variable-stream.cc:534
ns3::GammaRandomVariable::GetNormalValue
double GetNormalValue(double mean, double variance, double bound)
Returns a random double from a normal distribution with the specified mean, variance,...
Definition: random-variable-stream.cc:1016
ns3::NormalRandomVariable::m_bound
double m_bound
The bound on values that can be returned by this RNG stream.
Definition: random-variable-stream.h:1235
ns3::ZetaRandomVariable::GetValue
virtual double GetValue(void)
Returns a random double from a zeta distribution with the current alpha.
Definition: random-variable-stream.cc:1436
ns3::ErlangRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from an Erlang distribution with the current k and lambda.
Definition: random-variable-stream.cc:1148
ns3::EmpiricalRandomVariable::Interpolate
virtual double Interpolate(void)
Returns the next value in the empirical distribution using linear interpolation.
Definition: random-variable-stream.cc:1652
ns3::TriangularRandomVariable
The triangular distribution Random Number Generator (RNG) that allows stream numbers to be set determ...
Definition: random-variable-stream.h:1832
ns3::ExponentialRandomVariable::ExponentialRandomVariable
ExponentialRandomVariable()
Creates an exponential distribution RNG with the default values for the mean and upper bound.
Definition: random-variable-stream.cc:387
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::ExponentialRandomVariable::GetBound
double GetBound(void) const
Get the configured upper bound of this RNG.
Definition: random-variable-stream.cc:400
ns3::RandomVariableStream::RandomVariableStream
RandomVariableStream(const RandomVariableStream &o)
Copy constructor.
ns3::TriangularRandomVariable::GetValue
virtual double GetValue(void)
Returns a random double from a triangular distribution with the current mean, min,...
Definition: random-variable-stream.cc:1261
ns3::LogNormalRandomVariable::GetSigma
double GetSigma(void) const
Returns the sigma value for the log-normal distribution returned by this RNG stream.
Definition: random-variable-stream.cc:799
ns3::TriangularRandomVariable::m_max
double m_max
The upper bound on values that can be returned by this RNG stream.
Definition: random-variable-stream.h:2031
ns3::RandomVariableStream::Peek
RngStream * Peek(void) const
Get the pointer to the underlying RngStream.
Definition: random-variable-stream.cc:136
ns3::ZetaRandomVariable::GetAlpha
double GetAlpha(void) const
Returns the alpha value for the zeta distribution returned by this RNG stream.
Definition: random-variable-stream.cc:1387
ns3::DeterministicRandomVariable::GetValue
virtual double GetValue(void)
Returns the next value in the sequence.
Definition: random-variable-stream.cc:1501
ns3::NormalRandomVariable::m_y
double m_y
The algorithm produces two values at a time.
Definition: random-variable-stream.h:1243
ns3::LogNormalRandomVariable::GetMu
double GetMu(void) const
Returns the mu value for the log-normal distribution returned by this RNG stream.
Definition: random-variable-stream.cc:793
ns3::RandomVariableStream::RandomVariableStream
RandomVariableStream()
Default constructor.
Definition: random-variable-stream.cc:76
ns3::ParetoRandomVariable::ParetoRandomVariable
ParetoRandomVariable()
Creates a Pareto distribution RNG with the default values for the mean, the shape,...
Definition: random-variable-stream.cc:473
ns3::GammaRandomVariable::m_y
double m_y
The algorithm produces two values at a time.
Definition: random-variable-stream.h:1639
ns3::ZipfRandomVariable::m_alpha
double m_alpha
The alpha value for the Zipf distribution returned by this RNG stream.
Definition: random-variable-stream.h:2187
ns3::SequentialRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Get the next random value as an integer drawn from the distribution.
Definition: random-variable-stream.cc:361
ns3::GammaRandomVariable::m_beta
double m_beta
The beta value for the gamma distribution returned by this RNG stream.
Definition: random-variable-stream.h:1631
ns3::DeterministicRandomVariable::DeterministicRandomVariable
DeterministicRandomVariable()
Creates a deterministic RNG that will have a predetermined sequence of values.
Definition: random-variable-stream.cc:1460
ns3::NormalRandomVariable::GetVariance
double GetVariance(void) const
Returns the variance value for the normal distribution returned by this RNG stream.
Definition: random-variable-stream.cc:682
ns3::EmpiricalRandomVariable::PreSample
bool PreSample(double &value)
Do the initial rng draw and check against the extrema.
Definition: random-variable-stream.cc:1585
ns3::NormalRandomVariable::m_mean
double m_mean
The mean value for the normal distribution returned by this RNG stream.
Definition: random-variable-stream.h:1229
ns3::TriangularRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:1181
ns3::LogNormalRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a log-normal distribution with the current mu and sigma.
Definition: random-variable-stream.cc:879
ns3::ConstantRandomVariable::GetConstant
double GetConstant(void) const
Get the constant value returned by this RNG stream.
Definition: random-variable-stream.cc:236
ns3::EmpiricalRandomVariable::ValueCDF
Helper to hold one point of the CDF.
Definition: random-variable-stream.h:2555
ns3::SequentialRandomVariable::m_consecutive
uint32_t m_consecutive
The number of times each distinct value is repeated.
Definition: random-variable-stream.h:455
ns3::ConstantRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Get the next random value as an integer drawn from the distribution.
Definition: random-variable-stream.cc:262
ns3::ZipfRandomVariable::m_n
uint32_t m_n
The n value for the Zipf distribution returned by this RNG stream.
Definition: random-variable-stream.h:2184
ns3::ErlangRandomVariable::GetLambda
double GetLambda(void) const
Returns the lambda value for the Erlang distribution returned by this RNG stream.
Definition: random-variable-stream.cc:1099
ns3::UniformRandomVariable::GetMin
double GetMin(void) const
Get the lower bound on randoms returned by GetValue(void).
Definition: random-variable-stream.cc:169
ns3::RandomVariableStream::IsAntithetic
bool IsAntithetic(void) const
Check if antithetic values will be generated.
Definition: random-variable-stream.cc:94
ns3::SequentialRandomVariable::m_current
double m_current
The current sequence value.
Definition: random-variable-stream.h:458
ns3::EmpiricalRandomVariable::ValueCDF::cdf
double cdf
The CDF at value
Definition: random-variable-stream.h:2570
ns3::RandomVariableStream::m_isAntithetic
bool m_isAntithetic
Indicates if antithetic values should be generated by this RNG stream.
Definition: random-variable-stream.h:185
ns3::LogNormalRandomVariable::m_mu
double m_mu
The mu value for the log-normal distribution returned by this RNG stream.
Definition: random-variable-stream.h:1461
ns3::EmpiricalRandomVariable::Validate
void Validate(void)
Check that the CDF is valid.
Definition: random-variable-stream.cc:1704
ns3::LogNormalRandomVariable
The log-normal distribution Random Number Generator (RNG) that allows stream numbers to be set determ...
Definition: random-variable-stream.h:1292
ns3::DeterministicRandomVariable::SetValueArray
void SetValueArray(double *values, std::size_t length)
Sets the array of values that holds the predetermined sequence.
Definition: random-variable-stream.cc:1479
ns3::EmpiricalRandomVariable::m_interpolate
bool m_interpolate
If true GetValue will interpolate, otherwise treat CDF as normal histogram.
Definition: random-variable-stream.h:2630
ns3::EmpiricalRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Returns the next value in the empirical distribution.
Definition: random-variable-stream.cc:1578
ns3::ErlangRandomVariable
The Erlang distribution Random Number Generator (RNG) that allows stream numbers to be set determinis...
Definition: random-variable-stream.h:1680
ns3::WeibullRandomVariable::m_shape
double m_shape
The shape parameter for the Weibull distribution returned by this RNG stream.
Definition: random-variable-stream.h:999
ns3::NormalRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a normal distribution with the current mean,...
Definition: random-variable-stream.cc:759
ns3::TriangularRandomVariable::TriangularRandomVariable
TriangularRandomVariable()
Creates a triangular distribution RNG with the default values for the mean, lower bound,...
Definition: random-variable-stream.cc:1202
ns3::RandomVariableStream::GetInteger
virtual uint32_t GetInteger(void)=0
Get the next random value as an integer drawn from the distribution.
ns3::GammaRandomVariable::GetBeta
double GetBeta(void) const
Returns the beta value for the gamma distribution returned by this RNG stream.
Definition: random-variable-stream.cc:921
ns3::ConstantRandomVariable::m_constant
double m_constant
The constant value returned by this RNG stream.
Definition: random-variable-stream.h:359
ns3::GammaRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a gamma distribution with the current alpha and beta.
Definition: random-variable-stream.cc:1009
ns3::ZetaRandomVariable
The zeta distribution Random Number Generator (RNG) that allows stream numbers to be set deterministi...
Definition: random-variable-stream.h:2235
ns3::Ptr< RandomVariableStream >
ns3::ExponentialRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Get the next random value as an integer drawn from the distribution.
Definition: random-variable-stream.cc:443
ns3::ZetaRandomVariable::m_alpha
double m_alpha
The alpha value for the zeta distribution returned by this RNG stream.
Definition: random-variable-stream.h:2316
ns3::UniformRandomVariable
The uniform distribution Random Number Generator (RNG).
Definition: random-variable-stream.h:235
ns3::RandomVariableStream::operator=
RandomVariableStream & operator=(const RandomVariableStream &o)
Assignment operator.
ns3::min
double min(double x, double y)
Definition: cobalt-queue-disc.cc:132
ns3::UniformRandomVariable::m_min
double m_min
The lower bound on values that can be returned by this RNG stream.
Definition: random-variable-stream.h:300
ns3::UniformRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:145
ns3::UniformRandomVariable::GetMax
double GetMax(void) const
Get the upper bound on values returned by GetValue(void).
Definition: random-variable-stream.cc:175
ns3::ErlangRandomVariable::m_lambda
double m_lambda
The lambda value for the Erlang distribution returned by this RNG stream.
Definition: random-variable-stream.h:1798
ns3::ParetoRandomVariable
The Pareto distribution Random Number Generator (RNG).
Definition: random-variable-stream.h:641
ns3::ConstantRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:216
bianchi11ax.k
int k
Definition: bianchi11ax.py:129
sample-rng-plot.alpha
alpha
Definition: sample-rng-plot.py:37
ns3::TriangularRandomVariable::m_min
double m_min
The lower bound on values that can be returned by this RNG stream.
Definition: random-variable-stream.h:2028
ns3::Object
A base class which provides memory management and object aggregation.
Definition: object.h:88
ns3::ConstantRandomVariable
The Random Number Generator (RNG) that returns a constant.
Definition: random-variable-stream.h:319
ns3::DeterministicRandomVariable::m_data
double * m_data
Array of values to return in sequence.
Definition: random-variable-stream.h:2400
ns3::NormalRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:645
ns3::WeibullRandomVariable
The Weibull distribution Random Number Generator (RNG) that allows stream numbers to be set determini...
Definition: random-variable-stream.h:855
ns3::ErlangRandomVariable::GetK
uint32_t GetK(void) const
Returns the k value for the Erlang distribution returned by this RNG stream.
Definition: random-variable-stream.cc:1093
ns3::NormalRandomVariable::INFINITE_VALUE
static const double INFINITE_VALUE
Large constant to bound the range.
Definition: random-variable-stream.h:1044
ns3::RandomVariableStream::m_stream
int64_t m_stream
The stream number for the RngStream.
Definition: random-variable-stream.h:188
ns3::ExponentialRandomVariable::GetMean
double GetMean(void) const
Get the configured mean value of this RNG.
Definition: random-variable-stream.cc:394
ns3::RandomVariableStream::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:54
ns3::TriangularRandomVariable::GetMean
double GetMean(void) const
Returns the mean value for the triangular distribution returned by this RNG stream.
Definition: random-variable-stream.cc:1210
ns3::GammaRandomVariable::GammaRandomVariable
GammaRandomVariable()
Creates a gamma distribution RNG with the default values for alpha and beta.
Definition: random-variable-stream.cc:905
ns3::ErlangRandomVariable::ErlangRandomVariable
ErlangRandomVariable()
Creates an Erlang distribution RNG with the default values for k and lambda.
Definition: random-variable-stream.cc:1086
ns3::UniformRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Get the next random value as an integer drawn from the distribution.
Definition: random-variable-stream.cc:207
ns3::ZipfRandomVariable::GetValue
virtual double GetValue(void)
Returns a random double from a Zipf distribution with the current n and alpha.
Definition: random-variable-stream.cc:1352
ns3::GammaRandomVariable::GetValue
virtual double GetValue(void)
Returns a random double from a gamma distribution with the current alpha and beta.
Definition: random-variable-stream.cc:1003
ns3::DeterministicRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:1451
ns3::ParetoRandomVariable::m_scale
double m_scale
The scale parameter for the Pareto distribution returned by this RNG stream.
Definition: random-variable-stream.h:790
ns3::EmpiricalRandomVariable
The Random Number Generator (RNG) that has a specified empirical distribution.
Definition: random-variable-stream.h:2482
ns3::EmpiricalRandomVariable::EmpiricalRandomVariable
EmpiricalRandomVariable(void)
Creates an empirical RNG that has a specified, empirical distribution, and configured for interpolati...
Definition: random-variable-stream.cc:1562
ns3::SequentialRandomVariable::m_min
double m_min
The first value of the sequence.
Definition: random-variable-stream.h:446
ns3::ExponentialRandomVariable::GetValue
virtual double GetValue(void)
Get the next random value as a double drawn from the distribution.
Definition: random-variable-stream.cc:437
ns3::EmpiricalRandomVariable::CDF
void CDF(double v, double c)
Specifies a point in the empirical distribution.
Definition: random-variable-stream.cc:1695
ns3::EmpiricalRandomVariable::operator<
friend bool operator<(ValueCDF a, ValueCDF b)
Comparison operator, for use by std::upper_bound.
Definition: random-variable-stream.cc:1540
ns3::WeibullRandomVariable::WeibullRandomVariable
WeibullRandomVariable()
Creates a Weibull distribution RNG with the default values for the scale, shape, and upper bound.
Definition: random-variable-stream.cc:570
ns3::ZipfRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:1276
ns3::UniformRandomVariable::UniformRandomVariable
UniformRandomVariable()
Creates a uniform distribution RNG with the default range.
Definition: random-variable-stream.cc:162
ns3::TriangularRandomVariable::GetMax
double GetMax(void) const
Returns the upper bound on values that can be returned by this RNG stream.
Definition: random-variable-stream.cc:1222
ns3::EmpiricalRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:1547
ns3::NormalRandomVariable::GetValue
virtual double GetValue(void)
Returns a random double from a normal distribution with the current mean, variance,...
Definition: random-variable-stream.cc:753
ns3::ZipfRandomVariable::GetAlpha
double GetAlpha(void) const
Returns the alpha value for the Zipf distribution returned by this RNG stream.
Definition: random-variable-stream.cc:1306
ns3::DeterministicRandomVariable::~DeterministicRandomVariable
virtual ~DeterministicRandomVariable()
Definition: random-variable-stream.cc:1468
ns3::LogNormalRandomVariable::LogNormalRandomVariable
LogNormalRandomVariable()
Creates a log-normal distribution RNG with the default values for mu and sigma.
Definition: random-variable-stream.cc:785
ns3::DeterministicRandomVariable
The Random Number Generator (RNG) that returns a predetermined sequence.
Definition: random-variable-stream.h:2355
ns3::RngStream
Combined Multiple-Recursive Generator MRG32k3a.
Definition: rng-stream.h:50
ns3::ZipfRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a Zipf distribution with the current n and alpha.
Definition: random-variable-stream.cc:1358
ns3::ExponentialRandomVariable::m_mean
double m_mean
The mean value of the unbounded exponential distribution.
Definition: random-variable-stream.h:592
ns3::NormalRandomVariable::m_v2
double m_v2
The algorithm produces two values at a time.
Definition: random-variable-stream.h:1241
ns3::ParetoRandomVariable::GetShape
double GetShape(void) const
Returns the shape parameter for the Pareto distribution returned by this RNG stream.
Definition: random-variable-stream.cc:488
ns3::ZetaRandomVariable::ZetaRandomVariable
ZetaRandomVariable()
Creates a zeta distribution RNG with the default value for alpha.
Definition: random-variable-stream.cc:1380
ns3::WeibullRandomVariable::m_bound
double m_bound
The upper bound on values that can be returned by this RNG stream.
Definition: random-variable-stream.h:1002
ns3::TriangularRandomVariable::m_mean
double m_mean
The mean value for the triangular distribution returned by this RNG stream.
Definition: random-variable-stream.h:2025
ns3::ZipfRandomVariable
The Zipf distribution Random Number Generator (RNG) that allows stream numbers to be set deterministi...
Definition: random-variable-stream.h:2095
ns3::SequentialRandomVariable::GetValue
virtual double GetValue(void)
Get the next random value as a double drawn from the distribution.
Definition: random-variable-stream.cc:335
ns3::WeibullRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:549
ns3::WeibullRandomVariable::GetBound
double GetBound(void) const
Returns the upper bound on values that can be returned by this RNG stream.
Definition: random-variable-stream.cc:590
ns3::WeibullRandomVariable::m_scale
double m_scale
The scale parameter for the Weibull distribution returned by this RNG stream.
Definition: random-variable-stream.h:996
ns3::ConstantRandomVariable::ConstantRandomVariable
ConstantRandomVariable()
Creates a constant RNG with the default constant value.
Definition: random-variable-stream.cc:229
ns3::SequentialRandomVariable::GetIncrement
Ptr< RandomVariableStream > GetIncrement(void) const
Get the increment for the sequence.
Definition: random-variable-stream.cc:321
ns3::EmpiricalRandomVariable::m_validated
bool m_validated
true once the CDF has been validated.
Definition: random-variable-stream.h:2623
ns3::SequentialRandomVariable::SequentialRandomVariable
SequentialRandomVariable()
Creates a sequential RNG with the default values for the sequence parameters.
Definition: random-variable-stream.cc:295
ns3::WeibullRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a Weibull distribution with the current scale,...
Definition: random-variable-stream.cc:634
ns3::ParetoRandomVariable::m_bound
double m_bound
The upper bound on values that can be returned by this RNG stream.
Definition: random-variable-stream.h:796
ns3::SequentialRandomVariable::m_increment
Ptr< RandomVariableStream > m_increment
Increment between distinct values.
Definition: random-variable-stream.h:452
ns3::NormalRandomVariable::m_variance
double m_variance
The variance value for the normal distribution returned by this RNG stream.
Definition: random-variable-stream.h:1232
type-id.h
ns3::TypeId declaration; inline and template implementations.
ns3::RandomVariableStream::GetValue
virtual double GetValue(void)=0
Get the next random value as a double drawn from the distribution.
ns3::UniformRandomVariable::GetValue
virtual double GetValue(void)
Get the next random value as a double drawn from the distribution.
Definition: random-variable-stream.cc:201
ns3::NormalRandomVariable
The normal (Gaussian) distribution Random Number Generator (RNG) that allows stream numbers to be set...
Definition: random-variable-stream.h:1041
ns3::GammaRandomVariable
The gamma distribution Random Number Generator (RNG) that allows stream numbers to be set determinist...
Definition: random-variable-stream.h:1501
ns3::EmpiricalRandomVariable::ValueCDF::ValueCDF
ValueCDF(void)
Constructor.
Definition: random-variable-stream.cc:1524
ns3::LogNormalRandomVariable::GetValue
virtual double GetValue(void)
Returns a random double from a log-normal distribution with the current mu and sigma.
Definition: random-variable-stream.cc:873
ns3::ParetoRandomVariable::m_shape
double m_shape
The shape parameter for the Pareto distribution returned by this RNG stream.
Definition: random-variable-stream.h:793
ns3::ParetoRandomVariable::GetBound
double GetBound(void) const
Returns the upper bound on values that can be returned by this RNG stream.
Definition: random-variable-stream.cc:495
ns3::ParetoRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a Pareto distribution with the current mean,...
Definition: random-variable-stream.cc:540
ns3::UniformRandomVariable::m_max
double m_max
The upper bound on values that can be returned by this RNG stream.
Definition: random-variable-stream.h:303
ns3::SequentialRandomVariable::GetMin
double GetMin(void) const
Get the first value of the sequence.
Definition: random-variable-stream.cc:307
ns3::ZetaRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:1367
ns3::ErlangRandomVariable::m_k
uint32_t m_k
The k value for the Erlang distribution returned by this RNG stream.
Definition: random-variable-stream.h:1795
ns3::WeibullRandomVariable::GetValue
virtual double GetValue(void)
Returns a random double from a Weibull distribution with the current scale, shape,...
Definition: random-variable-stream.cc:628
ns3::SequentialRandomVariable::m_isCurrentSet
bool m_isCurrentSet
Indicates if the current sequence value has been properly initialized.
Definition: random-variable-stream.h:464
ns3::DeterministicRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Returns the next value in the sequence.
Definition: random-variable-stream.cc:1515
ns3::SequentialRandomVariable
The Random Number Generator (RNG) that returns a pattern of sequential values.
Definition: random-variable-stream.h:400
ns3::ErlangRandomVariable::GetExponentialValue
double GetExponentialValue(double mean, double bound)
Returns a random double from an exponential distribution with the specified mean and upper bound.
Definition: random-variable-stream.cc:1155
ns3::TriangularRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a triangular distribution with the current mean,...
Definition: random-variable-stream.cc:1267
ns3::RandomVariableStream::SetStream
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Definition: random-variable-stream.cc:100
ns3::ParetoRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:452
ns3::EmpiricalRandomVariable::DoInterpolate
double DoInterpolate(double r)
Linear interpolation between two points on the CDF to estimate the value at r.
Definition: random-variable-stream.cc:1668
ns3::SequentialRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:271
ns3::max
double max(double x, double y)
Definition: cobalt-queue-disc.cc:137
ns3::WeibullRandomVariable::GetScale
double GetScale(void) const
Returns the scale parameter for the Weibull distribution returned by this RNG stream.
Definition: random-variable-stream.cc:578
ns3::RandomVariableStream::~RandomVariableStream
virtual ~RandomVariableStream()
Destructor.
Definition: random-variable-stream.cc:81
ns3::NormalRandomVariable::NormalRandomVariable
NormalRandomVariable()
Creates a normal distribution RNG with the default values for the mean, variance, and bound.
Definition: random-variable-stream.cc:666
ns3::ExponentialRandomVariable::m_bound
double m_bound
The upper bound on values that can be returned by this RNG stream.
Definition: random-variable-stream.h:595
ns3::ZetaRandomVariable::GetInteger
virtual uint32_t GetInteger(void)
Returns a random unsigned integer from a zeta distribution with the current alpha.
Definition: random-variable-stream.cc:1442
ns3::GammaRandomVariable::m_nextValid
bool m_nextValid
True if the next normal value is valid.
Definition: random-variable-stream.h:1634
ns3::ExponentialRandomVariable
The exponential distribution Random Number Generator (RNG).
Definition: random-variable-stream.h:539
ns3::NormalRandomVariable::GetMean
double GetMean(void) const
Returns the mean value for the normal distribution returned by this RNG stream.
Definition: random-variable-stream.cc:676
ns3::RandomVariableStream
The basic uniform Random Number Generator (RNG).
Definition: random-variable-stream.h:98
ns3::RandomVariableStream::m_rng
RngStream * m_rng
Pointer to the underlying RngStream.
Definition: random-variable-stream.h:182
ns3::EmpiricalRandomVariable::ValueCDF::value
double value
The argument value.
Definition: random-variable-stream.h:2568
ns3::NormalRandomVariable::GetBound
double GetBound(void) const
Returns the bound on values that can be returned by this RNG stream.
Definition: random-variable-stream.cc:688
ns3::TriangularRandomVariable::GetMin
double GetMin(void) const
Returns the lower bound for the triangular distribution returned by this RNG stream.
Definition: random-variable-stream.cc:1216
ns3::ZetaRandomVariable::m_b
double m_b
Just for calculus simplifications.
Definition: random-variable-stream.h:2319
ns3::LogNormalRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:768
ns3::EmpiricalRandomVariable::SetInterpolate
bool SetInterpolate(bool interpolate)
Switch the mode between sampling the CDF and interpolating.
Definition: random-variable-stream.cc:1569
ns3::ZipfRandomVariable::GetN
uint32_t GetN(void) const
Returns the n value for the Zipf distribution returned by this RNG stream.
Definition: random-variable-stream.cc:1300
ns3::DeterministicRandomVariable::m_count
std::size_t m_count
Size of the array of values.
Definition: random-variable-stream.h:2394
ns3::GammaRandomVariable::m_v2
double m_v2
The algorithm produces two values at a time.
Definition: random-variable-stream.h:1637
ns3::RandomVariableStream::GetStream
int64_t GetStream(void) const
Returns the stream number for the RngStream.
Definition: random-variable-stream.cc:129
sample-rng-plot.n
n
Definition: sample-rng-plot.py:37
ns3::ZipfRandomVariable::ZipfRandomVariable
ZipfRandomVariable()
Creates a Zipf distribution RNG with the default values for n and alpha.
Definition: random-variable-stream.cc:1293
object.h
ns3::Object class declaration, which is the root of the Object hierarchy and Aggregation.
ns3::SequentialRandomVariable::m_currentConsecutive
uint32_t m_currentConsecutive
The number of times the current distinct value has been repeated.
Definition: random-variable-stream.h:461
ns3::ExponentialRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:370
ns3::EmpiricalRandomVariable::m_emp
std::vector< ValueCDF > m_emp
The vector of CDF points.
Definition: random-variable-stream.h:2625
ns3::GammaRandomVariable::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: random-variable-stream.cc:888
ns3::EmpiricalRandomVariable::GetValue
virtual double GetValue(void)
Returns the next value in the empirical distribution.
Definition: random-variable-stream.cc:1618
ns3::GammaRandomVariable::GetAlpha
double GetAlpha(void) const
Returns the alpha value for the gamma distribution returned by this RNG stream.
Definition: random-variable-stream.cc:915
ns3::LogNormalRandomVariable::m_sigma
double m_sigma
The sigma value for the log-normal distribution returned by this RNG stream.
Definition: random-variable-stream.h:1464