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"
37 #include "ns3/rng-seed-manager.h"
38 #include "ns3/random-variable-stream.h"
47 double increment = (end -
start) / (n - 1.);
50 for (uint32_t i = 0; i < n; ++i)
65 static const uint32_t N_RUNS = 5;
66 static const uint32_t N_BINS = 50;
67 static const uint32_t N_MEASUREMENTS = 1000000;
75 virtual void DoRun (
void);
79 :
TestCase (
"Uniform Random Variable Stream Generator")
90 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
94 gsl_histogram_set_ranges_uniform (h, 0., 1.);
98 gsl_histogram_increment (h, u->
GetValue ());
103 double expected = ((double)N_MEASUREMENTS / (
double)
N_BINS);
105 for (uint32_t i = 0; i <
N_BINS; ++i)
107 tmp[i] = gsl_histogram_get (h, i);
113 gsl_histogram_free (h);
115 double chiSquared = 0;
117 for (uint32_t i = 0; i <
N_BINS; ++i)
119 chiSquared += tmp[i];
128 SeedManager::SetSeed (time (0));
131 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
133 for (uint32_t i = 0; i <
N_RUNS; ++i)
140 sum /= (double)N_RUNS;
184 virtual void DoRun (
void);
188 :
TestCase (
"Antithetic Uniform Random Variable Stream Generator")
199 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
203 gsl_histogram_set_ranges_uniform (h, 0., 1.);
207 gsl_histogram_increment (h, u->
GetValue ());
212 double expected = ((double)N_MEASUREMENTS / (
double)
N_BINS);
214 for (uint32_t i = 0; i <
N_BINS; ++i)
216 tmp[i] = gsl_histogram_get (h, i);
222 gsl_histogram_free (h);
224 double chiSquared = 0;
226 for (uint32_t i = 0; i <
N_BINS; ++i)
228 chiSquared += tmp[i];
237 SeedManager::SetSeed (time (0));
240 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
242 for (uint32_t i = 0; i <
N_RUNS; ++i)
253 sum /= (double)N_RUNS;
297 virtual void DoRun (
void);
303 :
TestCase (
"Constant Random Variable Stream Generator")
314 SeedManager::SetSeed (time (0));
347 virtual void DoRun (
void);
353 :
TestCase (
"Sequential Random Variable Stream Generator")
364 SeedManager::SetSeed (time (0));
411 virtual void DoRun (
void);
415 :
TestCase (
"Normal Random Variable Stream Generator")
426 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
430 range[0] = -std::numeric_limits<double>::max ();
431 range[
N_BINS] = std::numeric_limits<double>::max ();
433 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
442 for (uint32_t i = 0; i <
N_BINS; ++i)
444 expected[i] = gsl_cdf_gaussian_P (range[i + 1], sigma) - gsl_cdf_gaussian_P (range[i], sigma);
450 gsl_histogram_increment (h, n->
GetValue ());
455 for (uint32_t i = 0; i <
N_BINS; ++i)
457 tmp[i] = gsl_histogram_get (h, i);
458 tmp[i] -= expected[i];
460 tmp[i] /= expected[i];
463 gsl_histogram_free (h);
465 double chiSquared = 0;
467 for (uint32_t i = 0; i <
N_BINS; ++i)
469 chiSquared += tmp[i];
478 SeedManager::SetSeed (time (0));
481 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
483 for (uint32_t i = 0; i <
N_RUNS; ++i)
490 sum /= (double)N_RUNS;
495 double variance = 2.0;
514 double expectedMean = mean;
537 virtual void DoRun (
void);
541 :
TestCase (
"Antithetic Normal Random Variable Stream Generator")
552 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
556 range[0] = -std::numeric_limits<double>::max ();
557 range[
N_BINS] = std::numeric_limits<double>::max ();
559 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
568 for (uint32_t i = 0; i <
N_BINS; ++i)
570 expected[i] = gsl_cdf_gaussian_P (range[i + 1], sigma) - gsl_cdf_gaussian_P (range[i], sigma);
576 gsl_histogram_increment (h, n->
GetValue ());
581 for (uint32_t i = 0; i <
N_BINS; ++i)
583 tmp[i] = gsl_histogram_get (h, i);
584 tmp[i] -= expected[i];
586 tmp[i] /= expected[i];
589 gsl_histogram_free (h);
591 double chiSquared = 0;
593 for (uint32_t i = 0; i <
N_BINS; ++i)
595 chiSquared += tmp[i];
604 SeedManager::SetSeed (time (0));
607 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
609 for (uint32_t i = 0; i <
N_RUNS; ++i)
620 sum /= (double)N_RUNS;
625 double variance = 2.0;
647 double expectedMean = mean;
670 virtual void DoRun (
void);
674 :
TestCase (
"Exponential Random Variable Stream Generator")
685 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
689 range[
N_BINS] = std::numeric_limits<double>::max ();
691 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
699 for (uint32_t i = 0; i <
N_BINS; ++i)
701 expected[i] = gsl_cdf_exponential_P (range[i + 1], mu) - gsl_cdf_exponential_P (range[i], mu);
707 gsl_histogram_increment (h, e->
GetValue ());
712 for (uint32_t i = 0; i <
N_BINS; ++i)
714 tmp[i] = gsl_histogram_get (h, i);
715 tmp[i] -= expected[i];
717 tmp[i] /= expected[i];
720 gsl_histogram_free (h);
722 double chiSquared = 0;
724 for (uint32_t i = 0; i <
N_BINS; ++i)
726 chiSquared += tmp[i];
735 SeedManager::SetSeed (time (0));
738 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
740 for (uint32_t i = 0; i <
N_RUNS; ++i)
747 sum /= (double)N_RUNS;
790 virtual void DoRun (
void);
794 :
TestCase (
"Antithetic Exponential Random Variable Stream Generator")
805 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
809 range[
N_BINS] = std::numeric_limits<double>::max ();
811 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
819 for (uint32_t i = 0; i <
N_BINS; ++i)
821 expected[i] = gsl_cdf_exponential_P (range[i + 1], mu) - gsl_cdf_exponential_P (range[i], mu);
827 gsl_histogram_increment (h, e->
GetValue ());
832 for (uint32_t i = 0; i <
N_BINS; ++i)
834 tmp[i] = gsl_histogram_get (h, i);
835 tmp[i] -= expected[i];
837 tmp[i] /= expected[i];
840 gsl_histogram_free (h);
842 double chiSquared = 0;
844 for (uint32_t i = 0; i <
N_BINS; ++i)
846 chiSquared += tmp[i];
855 SeedManager::SetSeed (time (0));
858 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
860 for (uint32_t i = 0; i <
N_RUNS; ++i)
871 sum /= (double)N_RUNS;
917 virtual void DoRun (
void);
921 :
TestCase (
"Pareto Random Variable Stream Generator")
932 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
936 range[
N_BINS] = std::numeric_limits<double>::max ();
938 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
946 double scale = mean * (shape - 1.0) / shape;
948 for (uint32_t i = 0; i <
N_BINS; ++i)
950 expected[i] = gsl_cdf_pareto_P (range[i + 1], shape, scale) - gsl_cdf_pareto_P (range[i], shape, scale);
956 gsl_histogram_increment (h, p->
GetValue ());
961 for (uint32_t i = 0; i <
N_BINS; ++i)
963 tmp[i] = gsl_histogram_get (h, i);
964 tmp[i] -= expected[i];
966 tmp[i] /= expected[i];
969 gsl_histogram_free (h);
971 double chiSquared = 0;
973 for (uint32_t i = 0; i <
N_BINS; ++i)
975 chiSquared += tmp[i];
984 SeedManager::SetSeed (time (0));
987 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
989 for (uint32_t i = 0; i <
N_RUNS; ++i)
996 sum /= (double)N_RUNS;
1002 double scale = mean * (shape - 1.0) / shape;
1028 double expectedMean = (shape * scale) / (shape - 1.0);
1051 virtual void DoRun (
void);
1055 :
TestCase (
"Antithetic Pareto Random Variable Stream Generator")
1066 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1068 double range[
N_BINS + 1];
1070 range[
N_BINS] = std::numeric_limits<double>::max ();
1072 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1080 double scale = mean * (shape - 1.0) / shape;
1082 for (uint32_t i = 0; i <
N_BINS; ++i)
1084 expected[i] = gsl_cdf_pareto_P (range[i + 1], shape, scale) - gsl_cdf_pareto_P (range[i], shape, scale);
1090 gsl_histogram_increment (h, p->
GetValue ());
1095 for (uint32_t i = 0; i <
N_BINS; ++i)
1097 tmp[i] = gsl_histogram_get (h, i);
1098 tmp[i] -= expected[i];
1100 tmp[i] /= expected[i];
1103 gsl_histogram_free (h);
1105 double chiSquared = 0;
1107 for (uint32_t i = 0; i <
N_BINS; ++i)
1109 chiSquared += tmp[i];
1118 SeedManager::SetSeed (time (0));
1121 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1123 for (uint32_t i = 0; i <
N_RUNS; ++i)
1134 sum /= (double)N_RUNS;
1140 double scale = mean * (shape - 1.0) / shape;
1170 double expectedMean = (shape * scale) / (shape - 1.0);
1193 virtual void DoRun (
void);
1197 :
TestCase (
"Weibull Random Variable Stream Generator")
1208 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1210 double range[
N_BINS + 1];
1212 range[
N_BINS] = std::numeric_limits<double>::max ();
1214 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1224 for (uint32_t i = 0; i <
N_BINS; ++i)
1226 expected[i] = gsl_cdf_weibull_P (range[i + 1], a, b) - gsl_cdf_weibull_P (range[i], a, b);
1232 gsl_histogram_increment (h, p->
GetValue ());
1237 for (uint32_t i = 0; i <
N_BINS; ++i)
1239 tmp[i] = gsl_histogram_get (h, i);
1240 tmp[i] -= expected[i];
1242 tmp[i] /= expected[i];
1245 gsl_histogram_free (h);
1247 double chiSquared = 0;
1249 for (uint32_t i = 0; i <
N_BINS; ++i)
1251 chiSquared += tmp[i];
1260 SeedManager::SetSeed (time (0));
1263 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1265 for (uint32_t i = 0; i <
N_RUNS; ++i)
1272 sum /= (double)N_RUNS;
1316 double expectedMean = scale;
1339 virtual void DoRun (
void);
1343 :
TestCase (
"Antithetic Weibull Random Variable Stream Generator")
1354 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1356 double range[
N_BINS + 1];
1358 range[
N_BINS] = std::numeric_limits<double>::max ();
1360 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1370 for (uint32_t i = 0; i <
N_BINS; ++i)
1372 expected[i] = gsl_cdf_weibull_P (range[i + 1], a, b) - gsl_cdf_weibull_P (range[i], a, b);
1378 gsl_histogram_increment (h, p->
GetValue ());
1383 for (uint32_t i = 0; i <
N_BINS; ++i)
1385 tmp[i] = gsl_histogram_get (h, i);
1386 tmp[i] -= expected[i];
1388 tmp[i] /= expected[i];
1391 gsl_histogram_free (h);
1393 double chiSquared = 0;
1395 for (uint32_t i = 0; i <
N_BINS; ++i)
1397 chiSquared += tmp[i];
1406 SeedManager::SetSeed (time (0));
1409 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1411 for (uint32_t i = 0; i <
N_RUNS; ++i)
1422 sum /= (double)N_RUNS;
1469 double expectedMean = scale;
1492 virtual void DoRun (
void);
1496 :
TestCase (
"Log-Normal Random Variable Stream Generator")
1507 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1509 double range[
N_BINS + 1];
1511 range[
N_BINS] = std::numeric_limits<double>::max ();
1513 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1523 for (uint32_t i = 0; i <
N_BINS; ++i)
1525 expected[i] = gsl_cdf_lognormal_P (range[i + 1], mu, sigma) - gsl_cdf_lognormal_P (range[i], mu, sigma);
1531 gsl_histogram_increment (h, n->
GetValue ());
1536 for (uint32_t i = 0; i <
N_BINS; ++i)
1538 tmp[i] = gsl_histogram_get (h, i);
1539 tmp[i] -= expected[i];
1541 tmp[i] /= expected[i];
1544 gsl_histogram_free (h);
1546 double chiSquared = 0;
1548 for (uint32_t i = 0; i <
N_BINS; ++i)
1550 chiSquared += tmp[i];
1559 SeedManager::SetSeed (time (0));
1562 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1564 for (uint32_t i = 0; i <
N_RUNS; ++i)
1571 sum /= (double)N_RUNS;
1600 double expectedMean = std::exp(mu + sigma * sigma / 2.0);
1628 virtual void DoRun (
void);
1632 :
TestCase (
"Antithetic Log-Normal Random Variable Stream Generator")
1643 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1645 double range[
N_BINS + 1];
1647 range[
N_BINS] = std::numeric_limits<double>::max ();
1649 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1659 for (uint32_t i = 0; i <
N_BINS; ++i)
1661 expected[i] = gsl_cdf_lognormal_P (range[i + 1], mu, sigma) - gsl_cdf_lognormal_P (range[i], mu, sigma);
1667 gsl_histogram_increment (h, n->
GetValue ());
1672 for (uint32_t i = 0; i <
N_BINS; ++i)
1674 tmp[i] = gsl_histogram_get (h, i);
1675 tmp[i] -= expected[i];
1677 tmp[i] /= expected[i];
1680 gsl_histogram_free (h);
1682 double chiSquared = 0;
1684 for (uint32_t i = 0; i <
N_BINS; ++i)
1686 chiSquared += tmp[i];
1695 SeedManager::SetSeed (time (0));
1698 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1700 for (uint32_t i = 0; i <
N_RUNS; ++i)
1711 sum /= (double)N_RUNS;
1743 double expectedMean = std::exp(mu + sigma * sigma / 2.0);
1771 virtual void DoRun (
void);
1775 :
TestCase (
"Gamma Random Variable Stream Generator")
1786 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1788 double range[
N_BINS + 1];
1790 range[
N_BINS] = std::numeric_limits<double>::max ();
1792 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1802 for (uint32_t i = 0; i <
N_BINS; ++i)
1804 expected[i] = gsl_cdf_gamma_P (range[i + 1], alpha, beta) - gsl_cdf_gamma_P (range[i], alpha, beta);
1810 gsl_histogram_increment (h, n->
GetValue ());
1815 for (uint32_t i = 0; i <
N_BINS; ++i)
1817 tmp[i] = gsl_histogram_get (h, i);
1818 tmp[i] -= expected[i];
1820 tmp[i] /= expected[i];
1823 gsl_histogram_free (h);
1825 double chiSquared = 0;
1827 for (uint32_t i = 0; i <
N_BINS; ++i)
1829 chiSquared += tmp[i];
1838 SeedManager::SetSeed (time (0));
1841 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1843 for (uint32_t i = 0; i <
N_RUNS; ++i)
1850 sum /= (double)N_RUNS;
1877 double expectedMean = alpha * beta;
1900 virtual void DoRun (
void);
1904 :
TestCase (
"Antithetic Gamma Random Variable Stream Generator")
1915 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1917 double range[
N_BINS + 1];
1919 range[
N_BINS] = std::numeric_limits<double>::max ();
1921 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1931 for (uint32_t i = 0; i <
N_BINS; ++i)
1933 expected[i] = gsl_cdf_gamma_P (range[i + 1], alpha, beta) - gsl_cdf_gamma_P (range[i], alpha, beta);
1939 gsl_histogram_increment (h, n->
GetValue ());
1944 for (uint32_t i = 0; i <
N_BINS; ++i)
1946 tmp[i] = gsl_histogram_get (h, i);
1947 tmp[i] -= expected[i];
1949 tmp[i] /= expected[i];
1952 gsl_histogram_free (h);
1954 double chiSquared = 0;
1956 for (uint32_t i = 0; i <
N_BINS; ++i)
1958 chiSquared += tmp[i];
1967 SeedManager::SetSeed (time (0));
1970 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1972 for (uint32_t i = 0; i <
N_RUNS; ++i)
1983 sum /= (double)N_RUNS;
2014 double expectedMean = alpha * beta;
2037 virtual void DoRun (
void);
2041 :
TestCase (
"Erlang Random Variable Stream Generator")
2052 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
2054 double range[
N_BINS + 1];
2056 range[
N_BINS] = std::numeric_limits<double>::max ();
2058 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
2066 double lambda = 1.0;
2071 for (uint32_t i = 0; i <
N_BINS; ++i)
2073 expected[i] = gsl_cdf_gamma_P (range[i + 1], k, lambda) - gsl_cdf_gamma_P (range[i], k, lambda);
2079 gsl_histogram_increment (h, n->
GetValue ());
2084 for (uint32_t i = 0; i <
N_BINS; ++i)
2086 tmp[i] = gsl_histogram_get (h, i);
2087 tmp[i] -= expected[i];
2089 tmp[i] /= expected[i];
2092 gsl_histogram_free (h);
2094 double chiSquared = 0;
2096 for (uint32_t i = 0; i <
N_BINS; ++i)
2098 chiSquared += tmp[i];
2107 SeedManager::SetSeed (time (0));
2110 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
2112 for (uint32_t i = 0; i <
N_RUNS; ++i)
2119 sum /= (double)N_RUNS;
2124 double lambda = 2.0;
2146 double expectedMean = k * lambda;
2169 virtual void DoRun (
void);
2173 :
TestCase (
"Antithetic Erlang Random Variable Stream Generator")
2184 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
2186 double range[
N_BINS + 1];
2188 range[
N_BINS] = std::numeric_limits<double>::max ();
2190 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
2198 double lambda = 1.0;
2203 for (uint32_t i = 0; i <
N_BINS; ++i)
2205 expected[i] = gsl_cdf_gamma_P (range[i + 1], k, lambda) - gsl_cdf_gamma_P (range[i], k, lambda);
2211 gsl_histogram_increment (h, n->
GetValue ());
2216 for (uint32_t i = 0; i <
N_BINS; ++i)
2218 tmp[i] = gsl_histogram_get (h, i);
2219 tmp[i] -= expected[i];
2221 tmp[i] /= expected[i];
2224 gsl_histogram_free (h);
2226 double chiSquared = 0;
2228 for (uint32_t i = 0; i <
N_BINS; ++i)
2230 chiSquared += tmp[i];
2239 SeedManager::SetSeed (time (0));
2242 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
2244 for (uint32_t i = 0; i <
N_RUNS; ++i)
2255 sum /= (double)N_RUNS;
2260 double lambda = 2.0;
2286 double expectedMean = k * lambda;
2305 virtual void DoRun (
void);
2309 :
TestCase (
"Zipf Random Variable Stream Generator")
2320 SeedManager::SetSeed (time (0));
2368 double expectedMean = 1.0;
2387 virtual void DoRun (
void);
2391 :
TestCase (
"Antithetic Zipf Random Variable Stream Generator")
2402 SeedManager::SetSeed (time (0));
2453 double expectedMean = 1.0;
2472 virtual void DoRun (
void);
2476 :
TestCase (
"Zeta Random Variable Stream Generator")
2487 SeedManager::SetSeed (time (0));
2517 double expectedMean = gsl_sf_zeta_int (alpha - 1) / gsl_sf_zeta_int (alpha);
2536 virtual void DoRun (
void);
2540 :
TestCase (
"Antithetic Zeta Random Variable Stream Generator")
2551 SeedManager::SetSeed (time (0));
2584 double expectedMean = gsl_sf_zeta_int (alpha - 1) / gsl_sf_zeta_int (alpha);
2603 virtual void DoRun (
void);
2609 :
TestCase (
"Deterministic Random Variable Stream Generator")
2620 SeedManager::SetSeed (time (0));
2628 double array1 [] = { 4, 4, 7, 7, 10, 10};
2629 uint64_t count1 = 6;
2652 double array2 [] = { 1000, 2000, 3000, 4000};
2653 uint64_t count2 = 4;
2680 virtual void DoRun (
void);
2684 :
TestCase (
"Empirical Random Variable Stream Generator")
2695 SeedManager::SetSeed (time (0));
2718 double expectedMean = 5.0;
2737 virtual void DoRun (
void);
2741 :
TestCase (
"EmpiricalAntithetic Random Variable Stream Generator")
2752 SeedManager::SetSeed (time (0));
2778 double expectedMean = 5.0;
2792 :
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)
Returns the value passed in.
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()
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.
double GetValue(uint32_t k, double lambda)
Returns a random double from an Erlang distribution with the specified k and lambda.
RandomVariableStreamExponentialTestCase()
virtual ~RandomVariableStreamErlangAntitheticTestCase()
double GetValue(double mean, double shape, double bound)
Returns a random double from a Pareto distribution with the specified mean, shape, and upper bound.
static const uint32_t N_BINS
virtual void DoRun(void)
Implementation to actually run this TestCase.
double GetValue(double mean, double variance, double bound=NormalRandomVariable::INFINITE_VALUE)
Returns a random double from a normal distribution with the specified mean, variance, and bound.
double GetValue(double alpha)
Returns a random double from a zeta distribution with the specified alpha.
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
virtual void DoRun(void)
Implementation to actually run this TestCase.
static const uint32_t N_BINS
virtual ~RandomVariableStreamZipfAntitheticTestCase()
virtual ~RandomVariableStreamGammaAntitheticTestCase()
virtual double GetValue(void)
Returns the next value in the sequence returned by this RNG stream.
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)
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
double GetValue(double alpha, double beta)
Returns a random double from a gamma distribution with the specified alpha and beta.
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.
double GetValue(double mu, double sigma)
Returns a random double from a log-normal distribution with the specified mu and sigma.
virtual void DoRun(void)
Implementation to actually run this TestCase.
static const uint32_t N_MEASUREMENTS
virtual ~RandomVariableStreamWeibullTestCase()
RandomVariableStreamNormalAntitheticTestCase()
RandomVariableStreamSequentialTestCase()
void SetValueArray(double *values, uint64_t length)
Sets the array of values that holds the predetermined sequence.
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
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
static const uint32_t N_BINS
double ChiSquaredTest(Ptr< WeibullRandomVariable > p)
virtual ~RandomVariableStreamParetoAntitheticTestCase()
double ChiSquaredTest(Ptr< GammaRandomVariable > n)
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()
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)
Returns a random double from an exponential distribution with the specified mean and upper bound...
RandomVariableStreamParetoTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
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
double GetValue(uint32_t n, double alpha)
Returns a random double from a Zipf distribution with the specified n and alpha.
Hold a floating point type.
static const uint32_t N_MEASUREMENTS
void SetAttribute(std::string name, const AttributeValue &value)
virtual ~RandomVariableStreamConstantTestCase()
RandomVariableStreamEmpiricalAntitheticTestCase()
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