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" 50 double increment = (end -
start) / (
n - 1.);
53 for (uint32_t i = 0; i <
n; ++i)
95 seed =
static_cast<uint32_t
> (time (0));
97 NS_LOG_DEBUG (
"Global seed and run number are default; seeding with time of day: " << seed);
104 NS_LOG_DEBUG (
"Global seed and run number are not default; using the non-default values seed: " <<
121 static const uint32_t N_BINS = 100;
122 static const uint32_t N_MEASUREMENTS = 1000000;
125 static const uint32_t N_RUNS = 2;
133 virtual void DoRun (
void);
137 :
TestCase (
"Uniform Random Variable Stream Generator")
148 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
152 gsl_histogram_set_ranges_uniform (h, 0., 1.);
156 gsl_histogram_increment (h, u->
GetValue ());
163 for (uint32_t i = 0; i <
N_BINS; ++i)
165 tmp[i] = gsl_histogram_get (h, i);
171 gsl_histogram_free (h);
173 double chiSquared = 0;
175 for (uint32_t i = 0; i <
N_BINS; ++i)
177 chiSquared += tmp[i];
188 double confidence = 0.99;
189 double maxStatistic = gsl_cdf_chisq_Pinv (confidence, (
N_BINS-1));
190 NS_LOG_DEBUG (
"Chi square required at " << confidence <<
" confidence for " <<
N_BINS <<
" bins is " << maxStatistic);
192 double result = maxStatistic;
194 for (uint32_t i = 0; i <
N_RUNS; ++i)
199 if (result < maxStatistic)
223 value =
x->GetValue ();
229 static const uint32_t UNIFORM_INTEGER_MIN = 0;
230 static const uint32_t UNIFORM_INTEGER_MAX = 4294967295U;
233 intValue =
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MIN);
236 intValue =
x->GetInteger (UNIFORM_INTEGER_MAX, UNIFORM_INTEGER_MAX);
240 for (
int i = 0; i < 20; i++)
242 intValue +=
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MIN + 1);
248 for (
int i = 0; i < 20; i++)
250 intValue =
x->GetInteger (UNIFORM_INTEGER_MAX - 1, UNIFORM_INTEGER_MAX);
251 if (intValue == UNIFORM_INTEGER_MAX)
259 intValue =
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MAX);
260 uint32_t intValue2 =
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MAX);
281 virtual void DoRun (
void);
285 :
TestCase (
"Antithetic Uniform Random Variable Stream Generator")
296 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
300 gsl_histogram_set_ranges_uniform (h, 0., 1.);
304 gsl_histogram_increment (h, u->
GetValue ());
311 for (uint32_t i = 0; i <
N_BINS; ++i)
313 tmp[i] = gsl_histogram_get (h, i);
319 gsl_histogram_free (h);
321 double chiSquared = 0;
323 for (uint32_t i = 0; i <
N_BINS; ++i)
325 chiSquared += tmp[i];
337 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
339 for (uint32_t i = 0; i <
N_RUNS; ++i)
373 value =
x->GetValue ();
394 virtual void DoRun (
void);
400 :
TestCase (
"Constant Random Variable Stream Generator")
444 virtual void DoRun (
void);
450 :
TestCase (
"Sequential Random Variable Stream Generator")
508 virtual void DoRun (
void);
512 :
TestCase (
"Normal Random Variable Stream Generator")
523 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
530 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
539 for (uint32_t i = 0; i <
N_BINS; ++i)
541 expected[i] = gsl_cdf_gaussian_P (range[i + 1], sigma) - gsl_cdf_gaussian_P (range[i], sigma);
547 gsl_histogram_increment (h,
n->GetValue ());
552 for (uint32_t i = 0; i <
N_BINS; ++i)
554 tmp[i] = gsl_histogram_get (h, i);
555 tmp[i] -= expected[i];
557 tmp[i] /= expected[i];
560 gsl_histogram_free (h);
562 double chiSquared = 0;
564 for (uint32_t i = 0; i <
N_BINS; ++i)
566 chiSquared += tmp[i];
578 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
580 for (uint32_t i = 0; i <
N_RUNS; ++i)
592 double variance = 2.0;
604 value =
x->GetValue ();
611 double expectedMean = mean;
634 virtual void DoRun (
void);
638 :
TestCase (
"Antithetic Normal Random Variable Stream Generator")
649 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
656 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
665 for (uint32_t i = 0; i <
N_BINS; ++i)
667 expected[i] = gsl_cdf_gaussian_P (range[i + 1], sigma) - gsl_cdf_gaussian_P (range[i], sigma);
673 gsl_histogram_increment (h,
n->GetValue ());
678 for (uint32_t i = 0; i <
N_BINS; ++i)
680 tmp[i] = gsl_histogram_get (h, i);
681 tmp[i] -= expected[i];
683 tmp[i] /= expected[i];
686 gsl_histogram_free (h);
688 double chiSquared = 0;
690 for (uint32_t i = 0; i <
N_BINS; ++i)
692 chiSquared += tmp[i];
704 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
706 for (uint32_t i = 0; i <
N_RUNS; ++i)
722 double variance = 2.0;
737 value =
x->GetValue ();
744 double expectedMean = mean;
767 virtual void DoRun (
void);
771 :
TestCase (
"Exponential Random Variable Stream Generator")
782 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
788 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
796 for (uint32_t i = 0; i <
N_BINS; ++i)
798 expected[i] = gsl_cdf_exponential_P (range[i + 1], mu) - gsl_cdf_exponential_P (range[i], mu);
804 gsl_histogram_increment (h, e->
GetValue ());
809 for (uint32_t i = 0; i <
N_BINS; ++i)
811 tmp[i] = gsl_histogram_get (h, i);
812 tmp[i] -= expected[i];
814 tmp[i] /= expected[i];
817 gsl_histogram_free (h);
819 double chiSquared = 0;
821 for (uint32_t i = 0; i <
N_BINS; ++i)
823 chiSquared += tmp[i];
835 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
837 for (uint32_t i = 0; i <
N_RUNS; ++i)
861 value =
x->GetValue ();
887 virtual void DoRun (
void);
891 :
TestCase (
"Antithetic Exponential Random Variable Stream Generator")
902 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
908 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
916 for (uint32_t i = 0; i <
N_BINS; ++i)
918 expected[i] = gsl_cdf_exponential_P (range[i + 1], mu) - gsl_cdf_exponential_P (range[i], mu);
924 gsl_histogram_increment (h, e->
GetValue ());
929 for (uint32_t i = 0; i <
N_BINS; ++i)
931 tmp[i] = gsl_histogram_get (h, i);
932 tmp[i] -= expected[i];
934 tmp[i] /= expected[i];
937 gsl_histogram_free (h);
939 double chiSquared = 0;
941 for (uint32_t i = 0; i <
N_BINS; ++i)
943 chiSquared += tmp[i];
955 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
957 for (uint32_t i = 0; i <
N_RUNS; ++i)
988 value =
x->GetValue ();
1014 virtual void DoRun (
void);
1018 :
TestCase (
"Pareto Random Variable Stream Generator")
1029 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1031 double range[
N_BINS + 1];
1035 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1042 for (uint32_t i = 0; i <
N_BINS; ++i)
1044 expected[i] = gsl_cdf_pareto_P (range[i + 1], shape, scale) - gsl_cdf_pareto_P (range[i], shape, scale);
1050 gsl_histogram_increment (h, p->
GetValue ());
1055 for (uint32_t i = 0; i <
N_BINS; ++i)
1057 tmp[i] = gsl_histogram_get (h, i);
1058 tmp[i] -= expected[i];
1060 tmp[i] /= expected[i];
1063 gsl_histogram_free (h);
1065 double chiSquared = 0;
1067 for (uint32_t i = 0; i <
N_BINS; ++i)
1069 chiSquared += tmp[i];
1081 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1083 for (uint32_t i = 0; i <
N_RUNS; ++i)
1107 value =
x->GetValue ();
1121 double expectedMean = (shape * scale) / (shape - 1.0);
1144 virtual void DoRun (
void);
1148 :
TestCase (
"Antithetic Pareto Random Variable Stream Generator")
1159 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1161 double range[
N_BINS + 1];
1165 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1172 for (uint32_t i = 0; i <
N_BINS; ++i)
1174 expected[i] = gsl_cdf_pareto_P (range[i + 1], shape, scale) - gsl_cdf_pareto_P (range[i], shape, scale);
1180 gsl_histogram_increment (h, p->
GetValue ());
1185 for (uint32_t i = 0; i <
N_BINS; ++i)
1187 tmp[i] = gsl_histogram_get (h, i);
1188 tmp[i] -= expected[i];
1190 tmp[i] /= expected[i];
1193 gsl_histogram_free (h);
1195 double chiSquared = 0;
1197 for (uint32_t i = 0; i <
N_BINS; ++i)
1199 chiSquared += tmp[i];
1211 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1213 for (uint32_t i = 0; i <
N_RUNS; ++i)
1244 value =
x->GetValue ();
1259 double expectedMean = (shape * scale) / (shape - 1.0);
1282 virtual void DoRun (
void);
1286 :
TestCase (
"Weibull Random Variable Stream Generator")
1297 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1299 double range[
N_BINS + 1];
1303 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1313 for (uint32_t i = 0; i <
N_BINS; ++i)
1315 expected[i] = gsl_cdf_weibull_P (range[i + 1], a, b) - gsl_cdf_weibull_P (range[i], a, b);
1321 gsl_histogram_increment (h, p->
GetValue ());
1326 for (uint32_t i = 0; i <
N_BINS; ++i)
1328 tmp[i] = gsl_histogram_get (h, i);
1329 tmp[i] -= expected[i];
1331 tmp[i] /= expected[i];
1334 gsl_histogram_free (h);
1336 double chiSquared = 0;
1338 for (uint32_t i = 0; i <
N_BINS; ++i)
1340 chiSquared += tmp[i];
1352 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1354 for (uint32_t i = 0; i <
N_RUNS; ++i)
1378 value =
x->GetValue ();
1405 double expectedMean = scale;
1428 virtual void DoRun (
void);
1432 :
TestCase (
"Antithetic Weibull Random Variable Stream Generator")
1443 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1445 double range[
N_BINS + 1];
1449 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1459 for (uint32_t i = 0; i <
N_BINS; ++i)
1461 expected[i] = gsl_cdf_weibull_P (range[i + 1], a, b) - gsl_cdf_weibull_P (range[i], a, b);
1467 gsl_histogram_increment (h, p->
GetValue ());
1472 for (uint32_t i = 0; i <
N_BINS; ++i)
1474 tmp[i] = gsl_histogram_get (h, i);
1475 tmp[i] -= expected[i];
1477 tmp[i] /= expected[i];
1480 gsl_histogram_free (h);
1482 double chiSquared = 0;
1484 for (uint32_t i = 0; i <
N_BINS; ++i)
1486 chiSquared += tmp[i];
1498 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1500 for (uint32_t i = 0; i <
N_RUNS; ++i)
1531 value =
x->GetValue ();
1558 double expectedMean = scale;
1581 virtual void DoRun (
void);
1585 :
TestCase (
"Log-Normal Random Variable Stream Generator")
1596 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1598 double range[
N_BINS + 1];
1602 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1612 for (uint32_t i = 0; i <
N_BINS; ++i)
1614 expected[i] = gsl_cdf_lognormal_P (range[i + 1], mu, sigma) - gsl_cdf_lognormal_P (range[i], mu, sigma);
1620 gsl_histogram_increment (h,
n->GetValue ());
1625 for (uint32_t i = 0; i <
N_BINS; ++i)
1627 tmp[i] = gsl_histogram_get (h, i);
1628 tmp[i] -= expected[i];
1630 tmp[i] /= expected[i];
1633 gsl_histogram_free (h);
1635 double chiSquared = 0;
1637 for (uint32_t i = 0; i <
N_BINS; ++i)
1639 chiSquared += tmp[i];
1651 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1653 for (uint32_t i = 0; i <
N_RUNS; ++i)
1677 value =
x->GetValue ();
1689 double expectedMean = std::exp(mu + sigma * sigma / 2.0);
1717 virtual void DoRun (
void);
1721 :
TestCase (
"Antithetic Log-Normal Random Variable Stream Generator")
1732 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1734 double range[
N_BINS + 1];
1738 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1748 for (uint32_t i = 0; i <
N_BINS; ++i)
1750 expected[i] = gsl_cdf_lognormal_P (range[i + 1], mu, sigma) - gsl_cdf_lognormal_P (range[i], mu, sigma);
1756 gsl_histogram_increment (h,
n->GetValue ());
1761 for (uint32_t i = 0; i <
N_BINS; ++i)
1763 tmp[i] = gsl_histogram_get (h, i);
1764 tmp[i] -= expected[i];
1766 tmp[i] /= expected[i];
1769 gsl_histogram_free (h);
1771 double chiSquared = 0;
1773 for (uint32_t i = 0; i <
N_BINS; ++i)
1775 chiSquared += tmp[i];
1787 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1789 for (uint32_t i = 0; i <
N_RUNS; ++i)
1820 value =
x->GetValue ();
1832 double expectedMean = std::exp(mu + sigma * sigma / 2.0);
1860 virtual void DoRun (
void);
1864 :
TestCase (
"Gamma Random Variable Stream Generator")
1875 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1877 double range[
N_BINS + 1];
1881 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1891 for (uint32_t i = 0; i <
N_BINS; ++i)
1893 expected[i] = gsl_cdf_gamma_P (range[i + 1],
alpha, beta) - gsl_cdf_gamma_P (range[i],
alpha, beta);
1899 gsl_histogram_increment (h,
n->GetValue ());
1904 for (uint32_t i = 0; i <
N_BINS; ++i)
1906 tmp[i] = gsl_histogram_get (h, i);
1907 tmp[i] -= expected[i];
1909 tmp[i] /= expected[i];
1912 gsl_histogram_free (h);
1914 double chiSquared = 0;
1916 for (uint32_t i = 0; i <
N_BINS; ++i)
1918 chiSquared += tmp[i];
1930 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1932 for (uint32_t i = 0; i <
N_RUNS; ++i)
1956 value =
x->GetValue ();
1966 double expectedMean =
alpha * beta;
1989 virtual void DoRun (
void);
1993 :
TestCase (
"Antithetic Gamma Random Variable Stream Generator")
2004 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
2006 double range[
N_BINS + 1];
2010 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
2020 for (uint32_t i = 0; i <
N_BINS; ++i)
2022 expected[i] = gsl_cdf_gamma_P (range[i + 1],
alpha, beta) - gsl_cdf_gamma_P (range[i],
alpha, beta);
2028 gsl_histogram_increment (h,
n->GetValue ());
2033 for (uint32_t i = 0; i <
N_BINS; ++i)
2035 tmp[i] = gsl_histogram_get (h, i);
2036 tmp[i] -= expected[i];
2038 tmp[i] /= expected[i];
2041 gsl_histogram_free (h);
2043 double chiSquared = 0;
2045 for (uint32_t i = 0; i <
N_BINS; ++i)
2047 chiSquared += tmp[i];
2059 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
2061 for (uint32_t i = 0; i <
N_RUNS; ++i)
2093 value =
x->GetValue ();
2103 double expectedMean =
alpha * beta;
2126 virtual void DoRun (
void);
2130 :
TestCase (
"Erlang Random Variable Stream Generator")
2141 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
2143 double range[
N_BINS + 1];
2147 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
2155 double lambda = 1.0;
2160 for (uint32_t i = 0; i <
N_BINS; ++i)
2162 expected[i] = gsl_cdf_gamma_P (range[i + 1], k, lambda) - gsl_cdf_gamma_P (range[i], k, lambda);
2168 gsl_histogram_increment (h,
n->GetValue ());
2173 for (uint32_t i = 0; i <
N_BINS; ++i)
2175 tmp[i] = gsl_histogram_get (h, i);
2176 tmp[i] -= expected[i];
2178 tmp[i] /= expected[i];
2181 gsl_histogram_free (h);
2183 double chiSquared = 0;
2185 for (uint32_t i = 0; i <
N_BINS; ++i)
2187 chiSquared += tmp[i];
2199 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
2201 for (uint32_t i = 0; i <
N_RUNS; ++i)
2213 double lambda = 2.0;
2225 value =
x->GetValue ();
2235 double expectedMean = k * lambda;
2258 virtual void DoRun (
void);
2262 :
TestCase (
"Antithetic Erlang Random Variable Stream Generator")
2273 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
2275 double range[
N_BINS + 1];
2279 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
2287 double lambda = 1.0;
2292 for (uint32_t i = 0; i <
N_BINS; ++i)
2294 expected[i] = gsl_cdf_gamma_P (range[i + 1], k, lambda) - gsl_cdf_gamma_P (range[i], k, lambda);
2300 gsl_histogram_increment (h,
n->GetValue ());
2305 for (uint32_t i = 0; i <
N_BINS; ++i)
2307 tmp[i] = gsl_histogram_get (h, i);
2308 tmp[i] -= expected[i];
2310 tmp[i] /= expected[i];
2313 gsl_histogram_free (h);
2315 double chiSquared = 0;
2317 for (uint32_t i = 0; i <
N_BINS; ++i)
2319 chiSquared += tmp[i];
2331 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
2333 for (uint32_t i = 0; i <
N_RUNS; ++i)
2349 double lambda = 2.0;
2365 value =
x->GetValue ();
2375 double expectedMean = k * lambda;
2394 virtual void DoRun (
void);
2398 :
TestCase (
"Zipf Random Variable Stream Generator")
2424 value =
x->GetValue ();
2457 double expectedMean = 1.0;
2476 virtual void DoRun (
void);
2480 :
TestCase (
"Antithetic Zipf Random Variable Stream Generator")
2509 value =
x->GetValue ();
2542 double expectedMean = 1.0;
2561 virtual void DoRun (
void);
2565 :
TestCase (
"Zeta Random Variable Stream Generator")
2589 value =
x->GetValue ();
2606 double expectedMean =
2607 gsl_sf_zeta_int (static_cast<int> (
alpha - 1)) /
2608 gsl_sf_zeta_int (static_cast<int> (
alpha) );
2627 virtual void DoRun (
void);
2631 :
TestCase (
"Antithetic Zeta Random Variable Stream Generator")
2658 value =
x->GetValue ();
2675 double expectedMean =
2676 gsl_sf_zeta_int (static_cast<int> (
alpha) - 1) /
2677 gsl_sf_zeta_int (static_cast<int> (
alpha) );
2696 virtual void DoRun (
void);
2702 :
TestCase (
"Deterministic Random Variable Stream Generator")
2721 double array1 [] = { 4, 4, 7, 7, 10, 10};
2722 std::size_t count1 = 6;
2745 double array2 [] = { 1000, 2000, 3000, 4000};
2746 std::size_t count2 = 4;
2773 virtual void DoRun (
void);
2777 :
TestCase (
"Empirical Random Variable Stream Generator")
2801 value =
x->GetValue ();
2811 double expectedMean = 5.0;
2837 virtual void DoRun (
void);
2841 :
TestCase (
"EmpiricalAntithetic Random Variable Stream Generator")
2868 value =
x->GetValue ();
2878 double expectedMean = 5.0;
2892 :
TestSuite (
"random-variable-stream-generators", UNIT)
static const uint32_t N_MEASUREMENTS
virtual ~RandomVariableStreamExponentialAntitheticTestCase()
static const uint32_t N_MEASUREMENTS
static const uint32_t N_RUNS
virtual double GetValue(void)
Returns the next value in the empirical distribution.
double GetValue(double constant)
Get the next random value, as a double equal to the argument.
static const uint32_t N_RUNS
double ChiSquaredTest(Ptr< LogNormalRandomVariable > n)
void FillHistoRangeUniformly(double *array, uint32_t n, double start, double end)
RandomVariableStreamLogNormalAntitheticTestCase()
virtual ~RandomVariableStreamZipfTestCase()
AttributeValue implementation for Boolean.
RandomVariableStreamGammaTestCase()
static const uint32_t N_RUNS
virtual ~RandomVariableStreamExponentialTestCase()
virtual ~RandomVariableStreamZetaAntitheticTestCase()
Hold variables of type string.
static RandomVariableStreamTestSuite randomVariableStreamTestSuite
RandomVariableStreamExponentialAntitheticTestCase()
virtual ~RandomVariableStreamGammaTestCase()
static const uint32_t N_RUNS
RandomVariableStreamTestSuite()
static const uint32_t N_RUNS
RandomVariableStreamParetoAntitheticTestCase()
virtual ~RandomVariableStreamEmpiricalTestCase()
static const uint32_t N_MEASUREMENTS
static const uint32_t N_RUNS
double ChiSquaredTest(Ptr< LogNormalRandomVariable > n)
virtual ~RandomVariableStreamLogNormalAntitheticTestCase()
static const uint32_t N_MEASUREMENTS
Hold a signed integer type.
RandomVariableStreamExponentialTestCase()
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual ~RandomVariableStreamErlangAntitheticTestCase()
static const uint32_t N_BINS
virtual void DoRun(void)
Implementation to actually run this TestCase.
RandomVariableStreamConstantTestCase()
double ChiSquaredTest(Ptr< NormalRandomVariable > n)
double ChiSquaredTest(Ptr< ExponentialRandomVariable > e)
static const uint32_t N_BINS
static const uint32_t N_MEASUREMENTS
double ChiSquaredTest(Ptr< ExponentialRandomVariable > e)
double ChiSquaredTest(Ptr< WeibullRandomVariable > p)
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static const uint32_t N_BINS
static const uint32_t N_RUNS
static const uint32_t N_RUNS
static const uint32_t N_BINS
static const uint32_t N_RUNS
static uint64_t GetRun(void)
Get the current run number.
void SetValueArray(double *values, std::size_t length)
Sets the array of values that holds the predetermined sequence.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static const uint32_t N_BINS
virtual ~RandomVariableStreamZipfAntitheticTestCase()
virtual ~RandomVariableStreamGammaAntitheticTestCase()
virtual double GetValue(void)
Get the next random value as a double drawn from the distribution.
static const double TOLERANCE
static const uint32_t N_MEASUREMENTS
static const uint32_t N_MEASUREMENTS
RandomVariableStreamWeibullTestCase()
RandomVariableStreamZetaTestCase()
virtual ~RandomVariableStreamNormalTestCase()
RandomVariableStreamZipfAntitheticTestCase()
virtual double GetValue(void)
Returns the next value in the sequence.
double ChiSquaredTest(Ptr< ErlangRandomVariable > n)
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
static const uint32_t N_MEASUREMENTS
static const uint32_t N_RUNS
virtual void DoRun(void)
Implementation to actually run this TestCase.
static const uint32_t N_BINS
#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.
static const uint32_t N_BINS
void CDF(double v, double c)
Specifies a point in the empirical distribution.
virtual ~RandomVariableStreamNormalAntitheticTestCase()
static const uint32_t N_MEASUREMENTS
static const uint32_t N_BINS
virtual void DoRun(void)
Implementation to actually run this TestCase.
RandomVariableStreamZipfTestCase()
static const uint32_t N_BINS
static const uint32_t N_MEASUREMENTS
static const uint32_t N_BINS
double ChiSquaredTest(Ptr< GammaRandomVariable > n)
RandomVariableStreamZetaAntitheticTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
#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 const uint32_t N_RUNS
static const double TOLERANCE
virtual void DoRun(void)
Implementation to actually run this TestCase.
double ChiSquaredTest(Ptr< NormalRandomVariable > n)
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~RandomVariableStreamErlangTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static const uint32_t N_MEASUREMENTS
virtual ~RandomVariableStreamWeibullTestCase()
Every class exported by the ns3 library is enclosed in the ns3 namespace.
RandomVariableStreamNormalAntitheticTestCase()
RandomVariableStreamSequentialTestCase()
virtual ~RandomVariableStreamParetoTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~RandomVariableStreamLogNormalTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
static const uint32_t N_MEASUREMENTS
static const uint32_t N_BINS
double ChiSquaredTest(Ptr< WeibullRandomVariable > p)
static uint32_t GetSeed(void)
Get the current seed value which will be used by all subsequently instantiated RandomVariableStream o...
virtual ~RandomVariableStreamParetoAntitheticTestCase()
double ChiSquaredTest(Ptr< GammaRandomVariable > n)
static void SetSeed(uint32_t seed)
Set the seed.
RandomVariableStreamDeterministicTestCase()
static const uint32_t N_BINS
static const uint32_t N_BINS
static const uint32_t N_MEASUREMENTS
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static const uint32_t N_MEASUREMENTS
RandomVariableStreamErlangAntitheticTestCase()
virtual ~RandomVariableStreamZetaTestCase()
#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...
virtual ~RandomVariableStreamEmpiricalAntitheticTestCase()
static const uint32_t N_MEASUREMENTS
RandomVariableStreamErlangTestCase()
double ChiSquaredTest(Ptr< ParetoRandomVariable > p)
RandomVariableStreamEmpiricalTestCase()
RandomVariableStreamWeibullAntitheticTestCase()
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
static const uint32_t N_MEASUREMENTS
static const uint32_t N_RUNS
static const uint32_t N_RUNS
static const uint32_t N_MEASUREMENTS
virtual ~RandomVariableStreamWeibullAntitheticTestCase()
double GetValue(double mean, double bound)
Get the next random value, as a double from the exponential distribution with the specified mean and ...
RandomVariableStreamParetoTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
double GetValue(double scale, double shape, double bound)
Returns a random double from a Pareto distribution with the specified scale, shape, and upper bound.
static const double TOLERANCE
double ChiSquaredTest(Ptr< ParetoRandomVariable > p)
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
RandomVariableStreamNormalTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
RandomVariableStreamLogNormalTestCase()
static const uint32_t N_BINS
#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.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
static const uint32_t N_MEASUREMENTS
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
virtual ~RandomVariableStreamConstantTestCase()
RandomVariableStreamEmpiricalAntitheticTestCase()
void SetTestSuiteSeed(void)
static const uint32_t N_RUNS
static const uint32_t N_MEASUREMENTS
virtual void DoRun(void)
Implementation to actually run this TestCase.
double ChiSquaredTest(Ptr< ErlangRandomVariable > n)
#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.
double GetValue(double scale, double shape, double bound)
Returns a random double from a Weibull distribution with the specified scale, shape, and upper bound.
virtual ~RandomVariableStreamDeterministicTestCase()
RandomVariableStreamGammaAntitheticTestCase()
virtual ~RandomVariableStreamSequentialTestCase()
static const uint32_t N_MEASUREMENTS
static const uint32_t N_MEASUREMENTS