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")
146 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
150 gsl_histogram_set_ranges_uniform (h, 0., 1.);
154 gsl_histogram_increment (h, u->
GetValue ());
161 for (uint32_t i = 0; i <
N_BINS; ++i)
163 tmp[i] = gsl_histogram_get (h, i);
169 gsl_histogram_free (h);
171 double chiSquared = 0;
173 for (uint32_t i = 0; i <
N_BINS; ++i)
175 chiSquared += tmp[i];
186 double confidence = 0.99;
187 double maxStatistic = gsl_cdf_chisq_Pinv (confidence, (
N_BINS - 1));
188 NS_LOG_DEBUG (
"Chi square required at " << confidence <<
" confidence for " <<
N_BINS <<
" bins is " << maxStatistic);
190 double result = maxStatistic;
192 for (uint32_t i = 0; i <
N_RUNS; ++i)
197 if (result < maxStatistic)
221 value =
x->GetValue ();
227 static const uint32_t UNIFORM_INTEGER_MIN = 0;
228 static const uint32_t UNIFORM_INTEGER_MAX = 4294967295U;
231 intValue =
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MIN);
234 intValue =
x->GetInteger (UNIFORM_INTEGER_MAX, UNIFORM_INTEGER_MAX);
238 for (
int i = 0; i < 20; i++)
240 intValue +=
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MIN + 1);
246 for (
int i = 0; i < 20; i++)
248 intValue =
x->GetInteger (UNIFORM_INTEGER_MAX - 1, UNIFORM_INTEGER_MAX);
249 if (intValue == UNIFORM_INTEGER_MAX)
257 intValue =
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MAX);
258 uint32_t intValue2 =
x->GetInteger (UNIFORM_INTEGER_MIN, UNIFORM_INTEGER_MAX);
279 virtual void DoRun (
void);
283 :
TestCase (
"Antithetic Uniform Random Variable Stream Generator")
292 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
296 gsl_histogram_set_ranges_uniform (h, 0., 1.);
300 gsl_histogram_increment (h, u->
GetValue ());
307 for (uint32_t i = 0; i <
N_BINS; ++i)
309 tmp[i] = gsl_histogram_get (h, i);
315 gsl_histogram_free (h);
317 double chiSquared = 0;
319 for (uint32_t i = 0; i <
N_BINS; ++i)
321 chiSquared += tmp[i];
333 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
335 for (uint32_t i = 0; i <
N_RUNS; ++i)
369 value =
x->GetValue ();
390 virtual void DoRun (
void);
396 :
TestCase (
"Constant Random Variable Stream Generator")
438 virtual void DoRun (
void);
444 :
TestCase (
"Sequential Random Variable Stream Generator")
500 virtual void DoRun (
void);
504 :
TestCase (
"Normal Random Variable Stream Generator")
513 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
520 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
529 for (uint32_t i = 0; i <
N_BINS; ++i)
531 expected[i] = gsl_cdf_gaussian_P (range[i + 1], sigma) - gsl_cdf_gaussian_P (range[i], sigma);
537 gsl_histogram_increment (h,
n->GetValue ());
542 for (uint32_t i = 0; i <
N_BINS; ++i)
544 tmp[i] = gsl_histogram_get (h, i);
545 tmp[i] -= expected[i];
547 tmp[i] /= expected[i];
550 gsl_histogram_free (h);
552 double chiSquared = 0;
554 for (uint32_t i = 0; i <
N_BINS; ++i)
556 chiSquared += tmp[i];
568 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
570 for (uint32_t i = 0; i <
N_RUNS; ++i)
582 double variance = 2.0;
594 value =
x->GetValue ();
601 double expectedMean = mean;
624 virtual void DoRun (
void);
628 :
TestCase (
"Antithetic Normal Random Variable Stream Generator")
637 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
644 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
653 for (uint32_t i = 0; i <
N_BINS; ++i)
655 expected[i] = gsl_cdf_gaussian_P (range[i + 1], sigma) - gsl_cdf_gaussian_P (range[i], sigma);
661 gsl_histogram_increment (h,
n->GetValue ());
666 for (uint32_t i = 0; i <
N_BINS; ++i)
668 tmp[i] = gsl_histogram_get (h, i);
669 tmp[i] -= expected[i];
671 tmp[i] /= expected[i];
674 gsl_histogram_free (h);
676 double chiSquared = 0;
678 for (uint32_t i = 0; i <
N_BINS; ++i)
680 chiSquared += tmp[i];
692 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
694 for (uint32_t i = 0; i <
N_RUNS; ++i)
710 double variance = 2.0;
725 value =
x->GetValue ();
732 double expectedMean = mean;
755 virtual void DoRun (
void);
759 :
TestCase (
"Exponential Random Variable Stream Generator")
768 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
774 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
782 for (uint32_t i = 0; i <
N_BINS; ++i)
784 expected[i] = gsl_cdf_exponential_P (range[i + 1], mu) - gsl_cdf_exponential_P (range[i], mu);
790 gsl_histogram_increment (h, e->
GetValue ());
795 for (uint32_t i = 0; i <
N_BINS; ++i)
797 tmp[i] = gsl_histogram_get (h, i);
798 tmp[i] -= expected[i];
800 tmp[i] /= expected[i];
803 gsl_histogram_free (h);
805 double chiSquared = 0;
807 for (uint32_t i = 0; i <
N_BINS; ++i)
809 chiSquared += tmp[i];
821 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
823 for (uint32_t i = 0; i <
N_RUNS; ++i)
847 value =
x->GetValue ();
873 virtual void DoRun (
void);
877 :
TestCase (
"Antithetic Exponential Random Variable Stream Generator")
886 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
892 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
900 for (uint32_t i = 0; i <
N_BINS; ++i)
902 expected[i] = gsl_cdf_exponential_P (range[i + 1], mu) - gsl_cdf_exponential_P (range[i], mu);
908 gsl_histogram_increment (h, e->
GetValue ());
913 for (uint32_t i = 0; i <
N_BINS; ++i)
915 tmp[i] = gsl_histogram_get (h, i);
916 tmp[i] -= expected[i];
918 tmp[i] /= expected[i];
921 gsl_histogram_free (h);
923 double chiSquared = 0;
925 for (uint32_t i = 0; i <
N_BINS; ++i)
927 chiSquared += tmp[i];
939 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
941 for (uint32_t i = 0; i <
N_RUNS; ++i)
972 value =
x->GetValue ();
998 virtual void DoRun (
void);
1002 :
TestCase (
"Pareto Random Variable Stream Generator")
1011 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1013 double range[
N_BINS + 1];
1017 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1024 for (uint32_t i = 0; i <
N_BINS; ++i)
1026 expected[i] = gsl_cdf_pareto_P (range[i + 1], shape, scale) - gsl_cdf_pareto_P (range[i], shape, scale);
1032 gsl_histogram_increment (h, p->
GetValue ());
1037 for (uint32_t i = 0; i <
N_BINS; ++i)
1039 tmp[i] = gsl_histogram_get (h, i);
1040 tmp[i] -= expected[i];
1042 tmp[i] /= expected[i];
1045 gsl_histogram_free (h);
1047 double chiSquared = 0;
1049 for (uint32_t i = 0; i <
N_BINS; ++i)
1051 chiSquared += tmp[i];
1063 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1065 for (uint32_t i = 0; i <
N_RUNS; ++i)
1089 value =
x->GetValue ();
1103 double expectedMean = (shape * scale) / (shape - 1.0);
1126 virtual void DoRun (
void);
1130 :
TestCase (
"Antithetic Pareto Random Variable Stream Generator")
1139 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1141 double range[
N_BINS + 1];
1145 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1152 for (uint32_t i = 0; i <
N_BINS; ++i)
1154 expected[i] = gsl_cdf_pareto_P (range[i + 1], shape, scale) - gsl_cdf_pareto_P (range[i], shape, scale);
1160 gsl_histogram_increment (h, p->
GetValue ());
1165 for (uint32_t i = 0; i <
N_BINS; ++i)
1167 tmp[i] = gsl_histogram_get (h, i);
1168 tmp[i] -= expected[i];
1170 tmp[i] /= expected[i];
1173 gsl_histogram_free (h);
1175 double chiSquared = 0;
1177 for (uint32_t i = 0; i <
N_BINS; ++i)
1179 chiSquared += tmp[i];
1191 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1193 for (uint32_t i = 0; i <
N_RUNS; ++i)
1224 value =
x->GetValue ();
1239 double expectedMean = (shape * scale) / (shape - 1.0);
1262 virtual void DoRun (
void);
1266 :
TestCase (
"Weibull Random Variable Stream Generator")
1275 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1277 double range[
N_BINS + 1];
1281 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1291 for (uint32_t i = 0; i <
N_BINS; ++i)
1293 expected[i] = gsl_cdf_weibull_P (range[i + 1], a, b) - gsl_cdf_weibull_P (range[i], a, b);
1299 gsl_histogram_increment (h, p->
GetValue ());
1304 for (uint32_t i = 0; i <
N_BINS; ++i)
1306 tmp[i] = gsl_histogram_get (h, i);
1307 tmp[i] -= expected[i];
1309 tmp[i] /= expected[i];
1312 gsl_histogram_free (h);
1314 double chiSquared = 0;
1316 for (uint32_t i = 0; i <
N_BINS; ++i)
1318 chiSquared += tmp[i];
1330 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1332 for (uint32_t i = 0; i <
N_RUNS; ++i)
1356 value =
x->GetValue ();
1383 double expectedMean = scale;
1406 virtual void DoRun (
void);
1410 :
TestCase (
"Antithetic Weibull Random Variable Stream Generator")
1419 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1421 double range[
N_BINS + 1];
1425 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1435 for (uint32_t i = 0; i <
N_BINS; ++i)
1437 expected[i] = gsl_cdf_weibull_P (range[i + 1], a, b) - gsl_cdf_weibull_P (range[i], a, b);
1443 gsl_histogram_increment (h, p->
GetValue ());
1448 for (uint32_t i = 0; i <
N_BINS; ++i)
1450 tmp[i] = gsl_histogram_get (h, i);
1451 tmp[i] -= expected[i];
1453 tmp[i] /= expected[i];
1456 gsl_histogram_free (h);
1458 double chiSquared = 0;
1460 for (uint32_t i = 0; i <
N_BINS; ++i)
1462 chiSquared += tmp[i];
1474 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1476 for (uint32_t i = 0; i <
N_RUNS; ++i)
1507 value =
x->GetValue ();
1534 double expectedMean = scale;
1557 virtual void DoRun (
void);
1561 :
TestCase (
"Log-Normal Random Variable Stream Generator")
1570 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1572 double range[
N_BINS + 1];
1576 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1586 for (uint32_t i = 0; i <
N_BINS; ++i)
1588 expected[i] = gsl_cdf_lognormal_P (range[i + 1], mu, sigma) - gsl_cdf_lognormal_P (range[i], mu, sigma);
1594 gsl_histogram_increment (h,
n->GetValue ());
1599 for (uint32_t i = 0; i <
N_BINS; ++i)
1601 tmp[i] = gsl_histogram_get (h, i);
1602 tmp[i] -= expected[i];
1604 tmp[i] /= expected[i];
1607 gsl_histogram_free (h);
1609 double chiSquared = 0;
1611 for (uint32_t i = 0; i <
N_BINS; ++i)
1613 chiSquared += tmp[i];
1625 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1627 for (uint32_t i = 0; i <
N_RUNS; ++i)
1651 value =
x->GetValue ();
1663 double expectedMean = std::exp (mu + sigma * sigma / 2.0);
1691 virtual void DoRun (
void);
1695 :
TestCase (
"Antithetic Log-Normal Random Variable Stream Generator")
1704 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1706 double range[
N_BINS + 1];
1710 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1720 for (uint32_t i = 0; i <
N_BINS; ++i)
1722 expected[i] = gsl_cdf_lognormal_P (range[i + 1], mu, sigma) - gsl_cdf_lognormal_P (range[i], mu, sigma);
1728 gsl_histogram_increment (h,
n->GetValue ());
1733 for (uint32_t i = 0; i <
N_BINS; ++i)
1735 tmp[i] = gsl_histogram_get (h, i);
1736 tmp[i] -= expected[i];
1738 tmp[i] /= expected[i];
1741 gsl_histogram_free (h);
1743 double chiSquared = 0;
1745 for (uint32_t i = 0; i <
N_BINS; ++i)
1747 chiSquared += tmp[i];
1759 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1761 for (uint32_t i = 0; i <
N_RUNS; ++i)
1792 value =
x->GetValue ();
1804 double expectedMean = std::exp (mu + sigma * sigma / 2.0);
1832 virtual void DoRun (
void);
1836 :
TestCase (
"Gamma Random Variable Stream Generator")
1845 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1847 double range[
N_BINS + 1];
1851 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1861 for (uint32_t i = 0; i <
N_BINS; ++i)
1863 expected[i] = gsl_cdf_gamma_P (range[i + 1],
alpha, beta) - gsl_cdf_gamma_P (range[i],
alpha, beta);
1869 gsl_histogram_increment (h,
n->GetValue ());
1874 for (uint32_t i = 0; i <
N_BINS; ++i)
1876 tmp[i] = gsl_histogram_get (h, i);
1877 tmp[i] -= expected[i];
1879 tmp[i] /= expected[i];
1882 gsl_histogram_free (h);
1884 double chiSquared = 0;
1886 for (uint32_t i = 0; i <
N_BINS; ++i)
1888 chiSquared += tmp[i];
1900 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
1902 for (uint32_t i = 0; i <
N_RUNS; ++i)
1926 value =
x->GetValue ();
1936 double expectedMean =
alpha * beta;
1959 virtual void DoRun (
void);
1963 :
TestCase (
"Antithetic Gamma Random Variable Stream Generator")
1972 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
1974 double range[
N_BINS + 1];
1978 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
1988 for (uint32_t i = 0; i <
N_BINS; ++i)
1990 expected[i] = gsl_cdf_gamma_P (range[i + 1],
alpha, beta) - gsl_cdf_gamma_P (range[i],
alpha, beta);
1996 gsl_histogram_increment (h,
n->GetValue ());
2001 for (uint32_t i = 0; i <
N_BINS; ++i)
2003 tmp[i] = gsl_histogram_get (h, i);
2004 tmp[i] -= expected[i];
2006 tmp[i] /= expected[i];
2009 gsl_histogram_free (h);
2011 double chiSquared = 0;
2013 for (uint32_t i = 0; i <
N_BINS; ++i)
2015 chiSquared += tmp[i];
2027 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
2029 for (uint32_t i = 0; i <
N_RUNS; ++i)
2061 value =
x->GetValue ();
2071 double expectedMean =
alpha * beta;
2094 virtual void DoRun (
void);
2098 :
TestCase (
"Erlang Random Variable Stream Generator")
2107 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
2109 double range[
N_BINS + 1];
2113 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
2121 double lambda = 1.0;
2126 for (uint32_t i = 0; i <
N_BINS; ++i)
2128 expected[i] = gsl_cdf_gamma_P (range[i + 1], k, lambda) - gsl_cdf_gamma_P (range[i], k, lambda);
2134 gsl_histogram_increment (h,
n->GetValue ());
2139 for (uint32_t i = 0; i <
N_BINS; ++i)
2141 tmp[i] = gsl_histogram_get (h, i);
2142 tmp[i] -= expected[i];
2144 tmp[i] /= expected[i];
2147 gsl_histogram_free (h);
2149 double chiSquared = 0;
2151 for (uint32_t i = 0; i <
N_BINS; ++i)
2153 chiSquared += tmp[i];
2165 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
2167 for (uint32_t i = 0; i <
N_RUNS; ++i)
2179 double lambda = 2.0;
2191 value =
x->GetValue ();
2201 double expectedMean = k * lambda;
2224 virtual void DoRun (
void);
2228 :
TestCase (
"Antithetic Erlang Random Variable Stream Generator")
2237 gsl_histogram * h = gsl_histogram_alloc (
N_BINS);
2239 double range[
N_BINS + 1];
2243 gsl_histogram_set_ranges (h, range,
N_BINS + 1);
2251 double lambda = 1.0;
2256 for (uint32_t i = 0; i <
N_BINS; ++i)
2258 expected[i] = gsl_cdf_gamma_P (range[i + 1], k, lambda) - gsl_cdf_gamma_P (range[i], k, lambda);
2264 gsl_histogram_increment (h,
n->GetValue ());
2269 for (uint32_t i = 0; i <
N_BINS; ++i)
2271 tmp[i] = gsl_histogram_get (h, i);
2272 tmp[i] -= expected[i];
2274 tmp[i] /= expected[i];
2277 gsl_histogram_free (h);
2279 double chiSquared = 0;
2281 for (uint32_t i = 0; i <
N_BINS; ++i)
2283 chiSquared += tmp[i];
2295 double maxStatistic = gsl_cdf_chisq_Qinv (0.05,
N_BINS);
2297 for (uint32_t i = 0; i <
N_RUNS; ++i)
2313 double lambda = 2.0;
2329 value =
x->GetValue ();
2339 double expectedMean = k * lambda;
2358 virtual void DoRun (
void);
2362 :
TestCase (
"Zipf Random Variable Stream Generator")
2386 value =
x->GetValue ();
2419 double expectedMean = 1.0;
2438 virtual void DoRun (
void);
2442 :
TestCase (
"Antithetic Zipf Random Variable Stream Generator")
2469 value =
x->GetValue ();
2502 double expectedMean = 1.0;
2521 virtual void DoRun (
void);
2525 :
TestCase (
"Zeta Random Variable Stream Generator")
2547 value =
x->GetValue ();
2564 double expectedMean =
2565 gsl_sf_zeta_int (static_cast<int> (
alpha - 1)) /
2566 gsl_sf_zeta_int (static_cast<int> (
alpha) );
2585 virtual void DoRun (
void);
2589 :
TestCase (
"Antithetic Zeta Random Variable Stream Generator")
2614 value =
x->GetValue ();
2631 double expectedMean =
2632 gsl_sf_zeta_int (static_cast<int> (
alpha) - 1) /
2633 gsl_sf_zeta_int (static_cast<int> (
alpha) );
2652 virtual void DoRun (
void);
2658 :
TestCase (
"Deterministic Random Variable Stream Generator")
2675 double array1 [] = { 4, 4, 7, 7, 10, 10};
2676 std::size_t count1 = 6;
2699 double array2 [] = { 1000, 2000, 3000, 4000};
2700 std::size_t count2 = 4;
2727 virtual void DoRun (
void);
2731 :
TestCase (
"Empirical Random Variable Stream Generator")
2744 x->SetInterpolate (
false);
2746 x->CDF ( 5.0, 0.25);
2752 double value =
x->GetValue ();
2754 "Incorrect value returned, expected only 5 or 10.");
2761 double value =
x->Interpolate ();
2776 double expectedMean = 6.25;
2803 virtual void DoRun (
void);
2807 :
TestCase (
"EmpiricalAntithetic Random Variable Stream Generator")
2820 x->SetInterpolate (
false);
2822 x->CDF ( 5.0, 0.25);
2831 double value =
x->GetValue ();
2833 "Incorrect value returned, expected only 5 or 10.");
2841 value =
x->Interpolate ();
2851 double expectedMean = 6.25;
2865 :
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.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
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.
bool SetInterpolate(bool interpolate)
Switch the mode between sampling the CDF and interpolating.
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