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 {
85 bool underflow =
true,
bool overflow =
true)
const
88 std::size_t nBins = gsl_histogram_bins (h);
89 double increment = (end -
start) / (nBins - 1.);
92 std::vector<double> range (nBins + 1);
94 for (
auto & r : range)
108 gsl_histogram_set_ranges (h, range.data (), nBins + 1);
124 double value =
rng->GetValue ();
147 template <
typename RNG>
163 auto rng = CreateObject<RNG> ();
190 const std::vector<double> & expected,
195 "Histogram and expected vector have different sizes.");
200 double value =
rng->GetValue ();
201 gsl_histogram_increment (h, value);
205 double chiSquared = 0;
206 std::size_t nBins = gsl_histogram_bins (h);
207 for (std::size_t i = 0; i < nBins; ++i)
209 double hbin = gsl_histogram_get (h, i);
210 double tmp = hbin - expected[i];
265 std::size_t nRuns)
const
270 for (std::size_t i = 0; i < nRuns; ++i)
276 sum /= (double)nRuns;
318 seed =
static_cast<uint32_t
> (time (0));
320 NS_LOG_DEBUG (
"Special run number value of zero; seeding with time of day: " << seed);
356 virtual void DoRun (
void);
360 :
TestCaseBase (
"Uniform Random Variable Stream Generator")
366 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
370 gsl_histogram_set_ranges_uniform (h, 0., 1.);
375 gsl_histogram_free (h);
385 double confidence = 0.99;
386 double maxStatistic = gsl_cdf_chisq_Pinv (confidence, (
N_BINS - 1));
387 NS_LOG_DEBUG (
"Chi square required at " << confidence <<
" confidence for " <<
N_BINS <<
" bins is " << maxStatistic);
389 double result = maxStatistic;
391 for (uint32_t i = 0; i <
N_RUNS; ++i)
396 if (result < maxStatistic)
420 value =
x->GetValue ();
426 static const uint32_t UNIFORM_INTEGER_MIN {0};
427 static const uint32_t UNIFORM_INTEGER_MAX {4294967295U};
430 intValue =
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MIN);
433 intValue =
x->GetInteger (UNIFORM_INTEGER_MAX, UNIFORM_INTEGER_MAX);
437 for (
int i = 0; i < 20; i++)
439 intValue +=
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MIN + 1);
445 for (
int i = 0; i < 20; i++)
447 intValue =
x->GetInteger (UNIFORM_INTEGER_MAX - 1, UNIFORM_INTEGER_MAX);
448 if (intValue == UNIFORM_INTEGER_MAX)
456 intValue =
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MAX);
457 uint32_t intValue2 =
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MAX);
477 virtual void DoRun (
void);
481 :
TestCaseBase (
"Antithetic Uniform Random Variable Stream Generator")
487 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
491 gsl_histogram_set_ranges_uniform (h, 0., 1.);
496 gsl_histogram_free (h);
508 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
530 value =
x->GetValue ();
548 virtual void DoRun (
void);
555 :
TestCaseBase (
"Constant Random Variable Stream Generator")
594 virtual void DoRun (
void);
601 :
TestCaseBase (
"Sequential Random Variable Stream Generator")
618 s->SetAttribute (
"Increment",
StringValue (
"ns3::UniformRandomVariable[Min=3.0|Max=3.0]"));
624 value = s->GetValue ();
626 value = s->GetValue ();
628 value = s->GetValue ();
630 value = s->GetValue ();
632 value = s->GetValue ();
634 value = s->GetValue ();
653 virtual void DoRun (
void);
660 :
TestCaseBase (
"Normal Random Variable Stream Generator")
666 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
669 std::vector<double> expected (
N_BINS);
676 for (std::size_t i = 0; i <
N_BINS; ++i)
678 expected[i] = gsl_cdf_gaussian_P (range[i + 1], sigma) - gsl_cdf_gaussian_P (range[i], sigma);
683 gsl_histogram_free (h);
694 auto rng = generator.Create ();
697 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
701 double variance = 2.0;
713 double expectedMean = mean;
714 double expectedRms = mean / std::sqrt (variance *
N_MEASUREMENTS);
734 virtual void DoRun (
void);
741 :
TestCaseBase (
"Antithetic Normal Random Variable Stream Generator")
747 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
750 std::vector<double> expected (
N_BINS);
757 for (std::size_t i = 0; i <
N_BINS; ++i)
759 expected[i] = gsl_cdf_gaussian_P (range[i + 1], sigma) - gsl_cdf_gaussian_P (range[i], sigma);
765 gsl_histogram_free (h);
777 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
781 double variance = 2.0;
796 double expectedMean = mean;
797 double expectedRms = mean / std::sqrt (variance *
N_MEASUREMENTS);
817 virtual void DoRun (
void);
824 :
TestCaseBase (
"Exponential Random Variable Stream Generator")
830 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
833 std::vector<double> expected (
N_BINS);
839 for (std::size_t i = 0; i <
N_BINS; ++i)
841 expected[i] = gsl_cdf_exponential_P (range[i + 1], mu) - gsl_cdf_exponential_P (range[i], mu);
847 gsl_histogram_free (h);
859 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
872 double expectedMean = mean;
893 virtual void DoRun (
void);
900 :
TestCaseBase (
"Antithetic Exponential Random Variable Stream Generator")
906 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
909 std::vector<double> expected (
N_BINS);
915 for (std::size_t i = 0; i <
N_BINS; ++i)
917 expected[i] = gsl_cdf_exponential_P (range[i + 1], mu) - gsl_cdf_exponential_P (range[i], mu);
923 gsl_histogram_free (h);
935 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
951 double expectedMean = mean;
972 virtual void DoRun (
void);
982 :
TestCaseBase (
"Pareto Random Variable Stream Generator")
988 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
991 std::vector<double> expected (
N_BINS);
996 for (std::size_t i = 0; i <
N_BINS; ++i)
998 expected[i] = gsl_cdf_pareto_P (range[i + 1], shape, scale) - gsl_cdf_pareto_P (range[i], shape, scale);
1004 gsl_histogram_free (h);
1016 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1039 double expectedMean = (shape * scale) / (shape - 1.0);
1059 virtual void DoRun (
void);
1069 :
TestCaseBase (
"Antithetic Pareto Random Variable Stream Generator")
1075 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1078 std::vector<double> expected (
N_BINS);
1083 for (std::size_t i = 0; i <
N_BINS; ++i)
1085 expected[i] = gsl_cdf_pareto_P (range[i + 1], shape, scale) - gsl_cdf_pareto_P (range[i], shape, scale);
1091 gsl_histogram_free (h);
1103 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1130 double expectedMean = (shape * scale) / (shape - 1.0);
1150 virtual void DoRun (
void);
1160 :
TestCaseBase (
"Weibull Random Variable Stream Generator")
1166 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1169 std::vector<double> expected (
N_BINS);
1177 for (std::size_t i = 0; i <
N_BINS; ++i)
1179 expected[i] = gsl_cdf_weibull_P (range[i + 1], a, b) - gsl_cdf_weibull_P (range[i], a, b);
1186 gsl_histogram_free (h);
1198 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1234 double expectedMean = scale;
1254 virtual void DoRun (
void);
1264 :
TestCaseBase (
"Antithetic Weibull Random Variable Stream Generator")
1270 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1273 std::vector<double> expected (
N_BINS);
1281 for (std::size_t i = 0; i <
N_BINS; ++i)
1283 expected[i] = gsl_cdf_weibull_P (range[i + 1], a, b) - gsl_cdf_weibull_P (range[i], a, b);
1289 gsl_histogram_free (h);
1301 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1340 double expectedMean = scale;
1360 virtual void DoRun (
void);
1370 :
TestCaseBase (
"Log-Normal Random Variable Stream Generator")
1376 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1379 std::vector<double> expected (
N_BINS);
1387 for (std::size_t i = 0; i <
N_BINS; ++i)
1389 expected[i] = gsl_cdf_lognormal_P (range[i + 1], mu, sigma) - gsl_cdf_lognormal_P (range[i], mu, sigma);
1395 gsl_histogram_free (h);
1407 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1429 double expectedMean = std::exp (mu + sigma * sigma / 2.0);
1456 virtual void DoRun (
void);
1466 :
TestCaseBase (
"Antithetic Log-Normal Random Variable Stream Generator")
1472 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1475 std::vector<double> expected (
N_BINS);
1483 for (std::size_t i = 0; i <
N_BINS; ++i)
1485 expected[i] = gsl_cdf_lognormal_P (range[i + 1], mu, sigma) - gsl_cdf_lognormal_P (range[i], mu, sigma);
1491 gsl_histogram_free (h);
1503 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1527 double expectedMean = std::exp (mu + sigma * sigma / 2.0);
1554 virtual void DoRun (
void);
1564 :
TestCaseBase (
"Gamma Random Variable Stream Generator")
1570 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1573 std::vector<double> expected (
N_BINS);
1581 for (std::size_t i = 0; i <
N_BINS; ++i)
1583 expected[i] = gsl_cdf_gamma_P (range[i + 1],
alpha, beta) - gsl_cdf_gamma_P (range[i],
alpha, beta);
1589 gsl_histogram_free (h);
1601 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1620 double expectedMean =
alpha * beta;
1640 virtual void DoRun (
void);
1650 :
TestCaseBase (
"Antithetic Gamma Random Variable Stream Generator")
1656 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1659 std::vector<double> expected (
N_BINS);
1667 for (std::size_t i = 0; i <
N_BINS; ++i)
1669 expected[i] = gsl_cdf_gamma_P (range[i + 1],
alpha, beta) - gsl_cdf_gamma_P (range[i],
alpha, beta);
1675 gsl_histogram_free (h);
1687 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1710 double expectedMean =
alpha * beta;
1730 virtual void DoRun (
void);
1740 :
TestCaseBase (
"Erlang Random Variable Stream Generator")
1746 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1749 std::vector<double> expected (
N_BINS);
1755 double lambda = 1.0;
1760 for (std::size_t i = 0; i <
N_BINS; ++i)
1762 expected[i] = gsl_cdf_gamma_P (range[i + 1],
k, lambda) - gsl_cdf_gamma_P (range[i],
k, lambda);
1768 gsl_histogram_free (h);
1780 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1784 double lambda = 2.0;
1799 double expectedMean =
k * lambda;
1819 virtual void DoRun (
void);
1829 :
TestCaseBase (
"Antithetic Erlang Random Variable Stream Generator")
1835 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1838 std::vector<double> expected (
N_BINS);
1844 double lambda = 1.0;
1849 for (std::size_t i = 0; i <
N_BINS; ++i)
1851 expected[i] = gsl_cdf_gamma_P (range[i + 1],
k, lambda) - gsl_cdf_gamma_P (range[i],
k, lambda);
1857 gsl_histogram_free (h);
1869 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1873 double lambda = 2.0;
1892 double expectedMean =
k * lambda;
1909 virtual void DoRun (
void);
1919 :
TestCaseBase (
"Zipf Random Variable Stream Generator")
1967 double expectedMean = 1.0;
1984 virtual void DoRun (
void);
1994 :
TestCaseBase (
"Antithetic Zipf Random Variable Stream Generator")
2045 double expectedMean = 1.0;
2062 virtual void DoRun (
void);
2072 :
TestCaseBase (
"Zeta Random Variable Stream Generator")
2102 double expectedMean =
2103 gsl_sf_zeta_int (
static_cast<int> (
alpha - 1)) /
2104 gsl_sf_zeta_int (
static_cast<int> (
alpha) );
2121 virtual void DoRun (
void);
2131 :
TestCaseBase (
"Antithetic Zeta Random Variable Stream Generator")
2164 double expectedMean =
2165 gsl_sf_zeta_int (
static_cast<int> (
alpha) - 1) /
2166 gsl_sf_zeta_int (
static_cast<int> (
alpha) );
2183 virtual void DoRun (
void);
2190 :
TestCaseBase (
"Deterministic Random Variable Stream Generator")
2205 double array1 [] = { 4, 4, 7, 7, 10, 10};
2206 std::size_t count1 = 6;
2207 s->SetValueArray (array1, count1);
2212 value = s->GetValue ();
2214 value = s->GetValue ();
2216 value = s->GetValue ();
2218 value = s->GetValue ();
2220 value = s->GetValue ();
2222 value = s->GetValue ();
2229 double array2 [] = { 1000, 2000, 3000, 4000};
2230 std::size_t count2 = 4;
2231 s->SetValueArray (array2, count2);
2234 value = s->GetValue ();
2236 value = s->GetValue ();
2238 value = s->GetValue ();
2240 value = s->GetValue ();
2242 value = s->GetValue ();
2256 virtual void DoRun (
void);
2266 :
TestCaseBase (
"Empirical Random Variable Stream Generator")
2277 x->SetInterpolate (
false);
2279 x->CDF ( 5.0, 0.25);
2285 double value =
x->GetValue ();
2287 "Incorrect value returned, expected only 5 or 10.");
2303 double expectedMean = 8.75;
2308 x->SetInterpolate (
true);
2323 expectedMean = 6.25;
2330 y->SetInterpolate (
false);
2348 virtual void DoRun (
void);
2358 :
TestCaseBase (
"EmpiricalAntithetic Random Variable Stream Generator")
2369 x->SetInterpolate (
false);
2371 x->CDF ( 5.0, 0.25);
2380 double value =
x->GetValue ();
2382 "Incorrect value returned, expected only 5 or 10.");
2389 double expectedMean = 8.75;
2393 x->SetInterpolate (
true);
2401 expectedMean = 6.25;
2418 virtual void DoRun (
void);
2422 :
TestCaseBase (
"NormalRandomVariable caching of parameters")
2432 double v1 =
n->GetValue (-10, 1, 10);
2433 double v2 =
n->GetValue (10, 1, 10);
2451 :
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
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double max(double x, double y)
double min(double x, double y)