25 #include <gsl/gsl_cdf.h>
26 #include <gsl/gsl_histogram.h>
27 #include <gsl/gsl_sf_zeta.h>
32 #include "ns3/boolean.h"
33 #include "ns3/double.h"
34 #include "ns3/string.h"
35 #include "ns3/integer.h"
38 #include "ns3/rng-seed-manager.h"
39 #include "ns3/random-variable-stream.h"
49 namespace RandomVariable {
92 bool underflow =
true,
bool overflow =
true)
const
95 std::size_t nBins = gsl_histogram_bins (h);
96 double increment = (end -
start) / (nBins - 1.);
99 std::vector<double> range (nBins + 1);
101 for (
auto & r : range)
115 gsl_histogram_set_ranges (h, range.data (), nBins + 1);
131 double value =
rng->GetValue ();
154 template <
typename RNG>
170 auto rng = CreateObject<RNG> ();
197 const std::vector<double> & expected,
202 "Histogram and expected vector have different sizes.");
207 double value =
rng->GetValue ();
208 gsl_histogram_increment (h, value);
212 double chiSquared = 0;
213 std::size_t nBins = gsl_histogram_bins (h);
214 for (std::size_t i = 0; i < nBins; ++i)
216 double hbin = gsl_histogram_get (h, i);
217 double tmp = hbin - expected[i];
272 std::size_t nRuns)
const
277 for (std::size_t i = 0; i < nRuns; ++i)
283 sum /= (double)nRuns;
325 seed =
static_cast<uint32_t
> (time (0));
327 NS_LOG_DEBUG (
"Special run number value of zero; seeding with time of day: " << seed);
364 virtual void DoRun (
void);
368 :
TestCaseBase (
"Uniform Random Variable Stream Generator")
374 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
378 gsl_histogram_set_ranges_uniform (h, 0., 1.);
383 gsl_histogram_free (h);
393 double confidence = 0.99;
394 double maxStatistic = gsl_cdf_chisq_Pinv (confidence, (
N_BINS - 1));
395 NS_LOG_DEBUG (
"Chi square required at " << confidence <<
" confidence for " <<
N_BINS <<
" bins is " << maxStatistic);
397 double result = maxStatistic;
399 for (uint32_t i = 0; i <
N_RUNS; ++i)
404 if (
result < maxStatistic)
428 value =
x->GetValue ();
434 static const uint32_t UNIFORM_INTEGER_MIN {0};
435 static const uint32_t UNIFORM_INTEGER_MAX {4294967295U};
438 intValue =
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MIN);
441 intValue =
x->GetInteger (UNIFORM_INTEGER_MAX, UNIFORM_INTEGER_MAX);
445 for (
int i = 0; i < 20; i++)
447 intValue +=
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MIN + 1);
453 for (
int i = 0; i < 20; i++)
455 intValue =
x->GetInteger (UNIFORM_INTEGER_MAX - 1, UNIFORM_INTEGER_MAX);
456 if (intValue == UNIFORM_INTEGER_MAX)
464 intValue =
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MAX);
465 uint32_t intValue2 =
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MAX);
486 virtual void DoRun (
void);
490 :
TestCaseBase (
"Antithetic Uniform Random Variable Stream Generator")
496 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
500 gsl_histogram_set_ranges_uniform (h, 0., 1.);
505 gsl_histogram_free (h);
517 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
539 value =
x->GetValue ();
558 virtual void DoRun (
void);
565 :
TestCaseBase (
"Constant Random Variable Stream Generator")
605 virtual void DoRun (
void);
612 :
TestCaseBase (
"Sequential Random Variable Stream Generator")
629 s->SetAttribute (
"Increment",
StringValue (
"ns3::UniformRandomVariable[Min=3.0|Max=3.0]"));
635 value = s->GetValue ();
637 value = s->GetValue ();
639 value = s->GetValue ();
641 value = s->GetValue ();
643 value = s->GetValue ();
645 value = s->GetValue ();
665 virtual void DoRun (
void);
672 :
TestCaseBase (
"Normal Random Variable Stream Generator")
678 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
681 std::vector<double> expected (
N_BINS);
688 for (std::size_t i = 0; i <
N_BINS; ++i)
690 expected[i] = gsl_cdf_gaussian_P (range[i + 1], sigma) - gsl_cdf_gaussian_P (range[i], sigma);
695 gsl_histogram_free (h);
706 auto rng = generator.Create ();
709 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
713 double variance = 2.0;
725 double expectedMean = mean;
726 double expectedRms = mean / std::sqrt (variance *
N_MEASUREMENTS);
747 virtual void DoRun (
void);
754 :
TestCaseBase (
"Antithetic Normal Random Variable Stream Generator")
760 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
763 std::vector<double> expected (
N_BINS);
770 for (std::size_t i = 0; i <
N_BINS; ++i)
772 expected[i] = gsl_cdf_gaussian_P (range[i + 1], sigma) - gsl_cdf_gaussian_P (range[i], sigma);
778 gsl_histogram_free (h);
790 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
794 double variance = 2.0;
809 double expectedMean = mean;
810 double expectedRms = mean / std::sqrt (variance *
N_MEASUREMENTS);
831 virtual void DoRun (
void);
838 :
TestCaseBase (
"Exponential Random Variable Stream Generator")
844 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
847 std::vector<double> expected (
N_BINS);
853 for (std::size_t i = 0; i <
N_BINS; ++i)
855 expected[i] = gsl_cdf_exponential_P (range[i + 1], mu) - gsl_cdf_exponential_P (range[i], mu);
861 gsl_histogram_free (h);
873 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
886 double expectedMean = mean;
908 virtual void DoRun (
void);
915 :
TestCaseBase (
"Antithetic Exponential Random Variable Stream Generator")
921 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
924 std::vector<double> expected (
N_BINS);
930 for (std::size_t i = 0; i <
N_BINS; ++i)
932 expected[i] = gsl_cdf_exponential_P (range[i + 1], mu) - gsl_cdf_exponential_P (range[i], mu);
938 gsl_histogram_free (h);
950 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
966 double expectedMean = mean;
988 virtual void DoRun (
void);
998 :
TestCaseBase (
"Pareto Random Variable Stream Generator")
1004 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1007 std::vector<double> expected (
N_BINS);
1012 for (std::size_t i = 0; i <
N_BINS; ++i)
1014 expected[i] = gsl_cdf_pareto_P (range[i + 1], shape, scale) - gsl_cdf_pareto_P (range[i], shape, scale);
1020 gsl_histogram_free (h);
1032 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1055 double expectedMean = (shape * scale) / (shape - 1.0);
1076 virtual void DoRun (
void);
1086 :
TestCaseBase (
"Antithetic Pareto Random Variable Stream Generator")
1092 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1095 std::vector<double> expected (
N_BINS);
1100 for (std::size_t i = 0; i <
N_BINS; ++i)
1102 expected[i] = gsl_cdf_pareto_P (range[i + 1], shape, scale) - gsl_cdf_pareto_P (range[i], shape, scale);
1108 gsl_histogram_free (h);
1120 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1147 double expectedMean = (shape * scale) / (shape - 1.0);
1168 virtual void DoRun (
void);
1178 :
TestCaseBase (
"Weibull Random Variable Stream Generator")
1184 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1187 std::vector<double> expected (
N_BINS);
1195 for (std::size_t i = 0; i <
N_BINS; ++i)
1197 expected[i] = gsl_cdf_weibull_P (range[i + 1], a, b) - gsl_cdf_weibull_P (range[i], a, b);
1204 gsl_histogram_free (h);
1216 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1252 double expectedMean = scale;
1273 virtual void DoRun (
void);
1283 :
TestCaseBase (
"Antithetic Weibull Random Variable Stream Generator")
1289 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1292 std::vector<double> expected (
N_BINS);
1300 for (std::size_t i = 0; i <
N_BINS; ++i)
1302 expected[i] = gsl_cdf_weibull_P (range[i + 1], a, b) - gsl_cdf_weibull_P (range[i], a, b);
1308 gsl_histogram_free (h);
1320 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1359 double expectedMean = scale;
1380 virtual void DoRun (
void);
1390 :
TestCaseBase (
"Log-Normal Random Variable Stream Generator")
1396 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1399 std::vector<double> expected (
N_BINS);
1407 for (std::size_t i = 0; i <
N_BINS; ++i)
1409 expected[i] = gsl_cdf_lognormal_P (range[i + 1], mu, sigma) - gsl_cdf_lognormal_P (range[i], mu, sigma);
1415 gsl_histogram_free (h);
1427 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1449 double expectedMean = std::exp (mu + sigma * sigma / 2.0);
1477 virtual void DoRun (
void);
1487 :
TestCaseBase (
"Antithetic Log-Normal Random Variable Stream Generator")
1493 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1496 std::vector<double> expected (
N_BINS);
1504 for (std::size_t i = 0; i <
N_BINS; ++i)
1506 expected[i] = gsl_cdf_lognormal_P (range[i + 1], mu, sigma) - gsl_cdf_lognormal_P (range[i], mu, sigma);
1512 gsl_histogram_free (h);
1524 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1548 double expectedMean = std::exp (mu + sigma * sigma / 2.0);
1576 virtual void DoRun (
void);
1586 :
TestCaseBase (
"Gamma Random Variable Stream Generator")
1592 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1595 std::vector<double> expected (
N_BINS);
1603 for (std::size_t i = 0; i <
N_BINS; ++i)
1605 expected[i] = gsl_cdf_gamma_P (range[i + 1],
alpha, beta) - gsl_cdf_gamma_P (range[i],
alpha, beta);
1611 gsl_histogram_free (h);
1623 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1642 double expectedMean =
alpha * beta;
1663 virtual void DoRun (
void);
1673 :
TestCaseBase (
"Antithetic Gamma Random Variable Stream Generator")
1679 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1682 std::vector<double> expected (
N_BINS);
1690 for (std::size_t i = 0; i <
N_BINS; ++i)
1692 expected[i] = gsl_cdf_gamma_P (range[i + 1],
alpha, beta) - gsl_cdf_gamma_P (range[i],
alpha, beta);
1698 gsl_histogram_free (h);
1710 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1733 double expectedMean =
alpha * beta;
1754 virtual void DoRun (
void);
1764 :
TestCaseBase (
"Erlang Random Variable Stream Generator")
1770 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1773 std::vector<double> expected (
N_BINS);
1779 double lambda = 1.0;
1784 for (std::size_t i = 0; i <
N_BINS; ++i)
1786 expected[i] = gsl_cdf_gamma_P (range[i + 1],
k, lambda) - gsl_cdf_gamma_P (range[i],
k, lambda);
1792 gsl_histogram_free (h);
1804 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1808 double lambda = 2.0;
1823 double expectedMean =
k * lambda;
1844 virtual void DoRun (
void);
1854 :
TestCaseBase (
"Antithetic Erlang Random Variable Stream Generator")
1860 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1863 std::vector<double> expected (
N_BINS);
1869 double lambda = 1.0;
1874 for (std::size_t i = 0; i <
N_BINS; ++i)
1876 expected[i] = gsl_cdf_gamma_P (range[i + 1],
k, lambda) - gsl_cdf_gamma_P (range[i],
k, lambda);
1882 gsl_histogram_free (h);
1894 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1898 double lambda = 2.0;
1917 double expectedMean =
k * lambda;
1935 virtual void DoRun (
void);
1945 :
TestCaseBase (
"Zipf Random Variable Stream Generator")
1993 double expectedMean = 1.0;
2011 virtual void DoRun (
void);
2021 :
TestCaseBase (
"Antithetic Zipf Random Variable Stream Generator")
2072 double expectedMean = 1.0;
2090 virtual void DoRun (
void);
2100 :
TestCaseBase (
"Zeta Random Variable Stream Generator")
2130 double expectedMean =
2131 gsl_sf_zeta_int (
static_cast<int> (
alpha - 1)) /
2132 gsl_sf_zeta_int (
static_cast<int> (
alpha) );
2150 virtual void DoRun (
void);
2160 :
TestCaseBase (
"Antithetic Zeta Random Variable Stream Generator")
2193 double expectedMean =
2194 gsl_sf_zeta_int (
static_cast<int> (
alpha) - 1) /
2195 gsl_sf_zeta_int (
static_cast<int> (
alpha) );
2213 virtual void DoRun (
void);
2220 :
TestCaseBase (
"Deterministic Random Variable Stream Generator")
2235 double array1 [] = { 4, 4, 7, 7, 10, 10};
2236 std::size_t count1 = 6;
2237 s->SetValueArray (array1, count1);
2242 value = s->GetValue ();
2244 value = s->GetValue ();
2246 value = s->GetValue ();
2248 value = s->GetValue ();
2250 value = s->GetValue ();
2252 value = s->GetValue ();
2259 double array2 [] = { 1000, 2000, 3000, 4000};
2260 std::size_t count2 = 4;
2261 s->SetValueArray (array2, count2);
2264 value = s->GetValue ();
2266 value = s->GetValue ();
2268 value = s->GetValue ();
2270 value = s->GetValue ();
2272 value = s->GetValue ();
2287 virtual void DoRun (
void);
2297 :
TestCaseBase (
"Empirical Random Variable Stream Generator")
2308 x->SetInterpolate (
false);
2310 x->CDF ( 5.0, 0.25);
2316 double value =
x->GetValue ();
2318 "Incorrect value returned, expected only 5 or 10.");
2334 double expectedMean = 8.75;
2339 x->SetInterpolate (
true);
2354 expectedMean = 6.25;
2361 y->SetInterpolate (
false);
2380 virtual void DoRun (
void);
2390 :
TestCaseBase (
"EmpiricalAntithetic Random Variable Stream Generator")
2401 x->SetInterpolate (
false);
2403 x->CDF ( 5.0, 0.25);
2412 double value =
x->GetValue ();
2414 "Incorrect value returned, expected only 5 or 10.");
2421 double expectedMean = 8.75;
2425 x->SetInterpolate (
true);
2433 expectedMean = 6.25;
2451 virtual void DoRun (
void);
2455 :
TestCaseBase (
"NormalRandomVariable caching of parameters")
2465 double v1 = n->GetValue (-10, 1, 10);
2466 double v2 = n->GetValue (10, 1, 10);
2485 :
TestSuite (
"random-variable-stream-generators", UNIT)
AttributeValue implementation for Boolean.
double GetValue(double constant)
Get the next random value, as a double equal to the argument.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold a signed integer type.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
static uint32_t GetSeed(void)
Get the current seed value which will be used by all subsequently instantiated RandomVariableStream o...
static void SetSeed(uint32_t seed)
Set the seed.
static uint64_t GetRun(void)
Get the current run number.
Hold variables of type string.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Test case for constant random variable stream generator.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test case for deterministic random variable stream generator.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test case for antithetic empirical distribution random variable stream generator.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
EmpiricalAntitheticTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test case for empirical distribution random variable stream generator.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
Test case for antithetic Erlang distribution random variable stream generator.
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
ErlangAntitheticTestCase()
Test case for Erlang distribution random variable stream generator.
virtual void DoRun(void)
Implementation to actually run this TestCase.
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
Test case for antithetic exponential distribution random variable stream generator.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, in rms.
ExponentialAntitheticTestCase()
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test case for exponential distribution random variable stream generator.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, in rms.
virtual void DoRun(void)
Implementation to actually run this TestCase.
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
Test case for antithetic gamma distribution random variable stream generator.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
virtual void DoRun(void)
Implementation to actually run this TestCase.
GammaAntitheticTestCase()
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
Test case for gamma distribution random variable stream generator.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test case for antithetic log-normal distribution random variable stream generator.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
LogNormalAntitheticTestCase()
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
Test case for log-normal distribution random variable stream generator.
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
Test case for antithetic normal distribution random variable stream generator.
NormalAntitheticTestCase()
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, in rms.
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test case for caching of Normal RV parameters (see issue #302)
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test case for normal distribution random variable stream generator.
virtual void DoRun(void)
Implementation to actually run this TestCase.
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, in rms.
Test case for antithetic Pareto distribution random variable stream generator.
ParetoAntitheticTestCase()
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test case for Pareto distribution random variable stream generator.
virtual void DoRun(void)
Implementation to actually run this TestCase.
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
RandomVariableStream test suite, covering all random number variable stream generator types.
Test case for sequential random variable stream generator.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation.
virtual void DoRun(void)
Implementation to actually run this TestCase.
A factory base class to create new instances of a random variable.
virtual Ptr< RandomVariableStream > Create(void) const =0
Create a new instance of a random variable stream.
Factory class to create new instances of a particular random variable stream.
bool m_anti
Whether to create antithetic random variable streams.
RngGenerator(bool anti=false)
Constructor.
Ptr< RandomVariableStream > Create(void) const
Create a new instance of a random variable stream.
Base class for RandomVariableStream test suites.
double ChiSquared(gsl_histogram *h, const std::vector< double > &expected, Ptr< RandomVariableStream > rng) const
Compute the chi squared value of a sampled distribution compared to the expected distribution.
static const uint32_t N_MEASUREMENTS
Number of samples to draw when populating the distributions.
double ChiSquaredsAverage(const RngGeneratorBase *generator, std::size_t nRuns) const
Average the chi squared value over some number of runs, each run with a new instance of the random nu...
virtual double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
static const uint32_t N_BINS
Number of bins for sampling the distributions.
void SetTestSuiteSeed(void)
Set the seed used for this test suite.
std::vector< double > UniformHistogramBins(gsl_histogram *h, double start, double end, bool underflow=true, bool overflow=true) const
Configure a GSL histogram with uniform bins, with optional under/over-flow bins.
bool m_seedSet
true if we've already set the seed the correctly.
TestCaseBase(std::string name)
Constructor.
static const uint32_t N_RUNS
Number of retry attempts to pass a chi-square test.
double Average(Ptr< RandomVariableStream > rng) const
Compute the average of a random variable.
Test case for antithetic Weibull distribution random variable stream generator.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
WeibullAntitheticTestCase()
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
Test case for Weibull distribution random variable stream generator.
virtual void DoRun(void)
Implementation to actually run this TestCase.
double ChiSquaredTest(Ptr< RandomVariableStream > rng) const
Compute the chi square value from a random variable.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
Test case for antithetic Zeta distribution random variable stream generator.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
Test case for Zeta distribution random variable stream generator.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test case for antithetic Zipf distribution random variable stream generator.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test case for Zipf distribution random variable stream generator.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static constexpr double TOLERANCE
Tolerance for testing rng values against expectation, as a fraction of mean value.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
static RandomVariableSuite randomVariableSuite
Static variable for test initialization.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
float alpha
Plot alpha value (transparency)
list x
Random number samples.
rng
Random number generator.