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"
45 FillHistoRangeUniformly (
double *array, uint32_t n,
double start,
double end)
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);
78 RandomVariableStreamUniformTestCase::RandomVariableStreamUniformTestCase ()
79 :
TestCase (
"Uniform Random Variable Stream Generator")
83 RandomVariableStreamUniformTestCase::~RandomVariableStreamUniformTestCase ()
90 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
94 gsl_histogram_set_ranges_uniform (h, 0., 1.);
96 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
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)
136 double result = ChiSquaredTest (u);
140 sum /= (double)N_RUNS;
142 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
158 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
161 NS_TEST_ASSERT_MSG_EQ ((value >= min),
true,
"Value less than minimum.");
162 NS_TEST_ASSERT_MSG_LT (value, max,
"Value greater than or equal to maximum.");
174 static const uint32_t N_RUNS = 5;
175 static const uint32_t N_BINS = 50;
176 static const uint32_t N_MEASUREMENTS = 1000000;
184 virtual void DoRun (
void);
187 RandomVariableStreamUniformAntitheticTestCase::RandomVariableStreamUniformAntitheticTestCase ()
188 :
TestCase (
"Antithetic Uniform Random Variable Stream Generator")
192 RandomVariableStreamUniformAntitheticTestCase::~RandomVariableStreamUniformAntitheticTestCase ()
199 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
203 gsl_histogram_set_ranges_uniform (h, 0., 1.);
205 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
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)
249 double result = ChiSquaredTest (u);
253 sum /= (double)N_RUNS;
255 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
274 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
277 NS_TEST_ASSERT_MSG_EQ ((value >= min),
true,
"Value less than minimum.");
278 NS_TEST_ASSERT_MSG_LT (value, max,
"Value greater than or equal to maximum.");
290 static const uint32_t N_MEASUREMENTS = 1000000;
291 static const double TOLERANCE = 1e-8;
297 virtual void DoRun (
void);
300 RandomVariableStreamConstantTestCase::RandomVariableStreamConstantTestCase ()
301 :
TestCase (
"Constant Random Variable Stream Generator")
305 RandomVariableStreamConstantTestCase::~RandomVariableStreamConstantTestCase ()
312 SeedManager::SetSeed (time (0));
321 NS_TEST_ASSERT_MSG_EQ_TOL (c->
GetValue (), constant, TOLERANCE,
"Constant value changed");
323 NS_TEST_ASSERT_MSG_NE (c->
GetValue (), constant,
"Constant value not changed");
327 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
329 NS_TEST_ASSERT_MSG_EQ_TOL (c->
GetValue (), constant, TOLERANCE,
"Constant value changed in loop");
339 static const double TOLERANCE = 1e-8;
345 virtual void DoRun (
void);
348 RandomVariableStreamSequentialTestCase::RandomVariableStreamSequentialTestCase ()
349 :
TestCase (
"Sequential Random Variable Stream Generator")
353 RandomVariableStreamSequentialTestCase::~RandomVariableStreamSequentialTestCase ()
360 SeedManager::SetSeed (time (0));
377 NS_TEST_ASSERT_MSG_EQ_TOL (value, 4, TOLERANCE,
"Sequence value 1 wrong.");
379 NS_TEST_ASSERT_MSG_EQ_TOL (value, 4, TOLERANCE,
"Sequence value 2 wrong.");
381 NS_TEST_ASSERT_MSG_EQ_TOL (value, 7, TOLERANCE,
"Sequence value 3 wrong.");
383 NS_TEST_ASSERT_MSG_EQ_TOL (value, 7, TOLERANCE,
"Sequence value 4 wrong.");
385 NS_TEST_ASSERT_MSG_EQ_TOL (value, 10, TOLERANCE,
"Sequence value 5 wrong.");
387 NS_TEST_ASSERT_MSG_EQ_TOL (value, 10, TOLERANCE,
"Sequence value 6 wrong.");
397 static const uint32_t N_RUNS = 5;
398 static const uint32_t N_BINS = 50;
399 static const uint32_t N_MEASUREMENTS = 1000000;
407 virtual void DoRun (
void);
410 RandomVariableStreamNormalTestCase::RandomVariableStreamNormalTestCase ()
411 :
TestCase (
"Normal Random Variable Stream Generator")
415 RandomVariableStreamNormalTestCase::~RandomVariableStreamNormalTestCase ()
422 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
424 double range[N_BINS + 1];
425 FillHistoRangeUniformly (range, N_BINS + 1, -4., 4.);
426 range[0] = -std::numeric_limits<double>::max ();
427 range[N_BINS] = std::numeric_limits<double>::max ();
429 gsl_histogram_set_ranges (h, range, N_BINS + 1);
431 double expected[N_BINS];
438 for (uint32_t i = 0; i < N_BINS; ++i)
440 expected[i] = gsl_cdf_gaussian_P (range[i + 1], sigma) - gsl_cdf_gaussian_P (range[i], sigma);
441 expected[i] *= N_MEASUREMENTS;
444 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
446 gsl_histogram_increment (h, n->
GetValue ());
451 for (uint32_t i = 0; i < N_BINS; ++i)
453 tmp[i] = gsl_histogram_get (h, i);
454 tmp[i] -= expected[i];
456 tmp[i] /= expected[i];
459 gsl_histogram_free (h);
461 double chiSquared = 0;
463 for (uint32_t i = 0; i < N_BINS; ++i)
465 chiSquared += tmp[i];
474 SeedManager::SetSeed (time (0));
477 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
479 for (uint32_t i = 0; i < N_RUNS; ++i)
482 double result = ChiSquaredTest (n);
486 sum /= (double)N_RUNS;
488 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
491 double variance = 2.0;
501 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
506 double valueMean = sum / N_MEASUREMENTS;
510 double expectedMean = mean;
513 double TOLERANCE = expectedMean * 1e-2;
514 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
523 static const uint32_t N_RUNS = 5;
524 static const uint32_t N_BINS = 50;
525 static const uint32_t N_MEASUREMENTS = 1000000;
533 virtual void DoRun (
void);
536 RandomVariableStreamNormalAntitheticTestCase::RandomVariableStreamNormalAntitheticTestCase ()
537 :
TestCase (
"Antithetic Normal Random Variable Stream Generator")
541 RandomVariableStreamNormalAntitheticTestCase::~RandomVariableStreamNormalAntitheticTestCase ()
548 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
550 double range[N_BINS + 1];
551 FillHistoRangeUniformly (range, N_BINS + 1, -4., 4.);
552 range[0] = -std::numeric_limits<double>::max ();
553 range[N_BINS] = std::numeric_limits<double>::max ();
555 gsl_histogram_set_ranges (h, range, N_BINS + 1);
557 double expected[N_BINS];
564 for (uint32_t i = 0; i < N_BINS; ++i)
566 expected[i] = gsl_cdf_gaussian_P (range[i + 1], sigma) - gsl_cdf_gaussian_P (range[i], sigma);
567 expected[i] *= N_MEASUREMENTS;
570 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
572 gsl_histogram_increment (h, n->
GetValue ());
577 for (uint32_t i = 0; i < N_BINS; ++i)
579 tmp[i] = gsl_histogram_get (h, i);
580 tmp[i] -= expected[i];
582 tmp[i] /= expected[i];
585 gsl_histogram_free (h);
587 double chiSquared = 0;
589 for (uint32_t i = 0; i < N_BINS; ++i)
591 chiSquared += tmp[i];
600 SeedManager::SetSeed (time (0));
603 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
605 for (uint32_t i = 0; i < N_RUNS; ++i)
612 double result = ChiSquaredTest (n);
616 sum /= (double)N_RUNS;
618 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
621 double variance = 2.0;
634 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
639 double valueMean = sum / N_MEASUREMENTS;
643 double expectedMean = mean;
646 double TOLERANCE = expectedMean * 1e-2;
647 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
656 static const uint32_t N_RUNS = 5;
657 static const uint32_t N_BINS = 50;
658 static const uint32_t N_MEASUREMENTS = 1000000;
666 virtual void DoRun (
void);
669 RandomVariableStreamExponentialTestCase::RandomVariableStreamExponentialTestCase ()
670 :
TestCase (
"Exponential Random Variable Stream Generator")
674 RandomVariableStreamExponentialTestCase::~RandomVariableStreamExponentialTestCase ()
681 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
683 double range[N_BINS + 1];
684 FillHistoRangeUniformly (range, N_BINS + 1, 0., 10.);
685 range[N_BINS] = std::numeric_limits<double>::max ();
687 gsl_histogram_set_ranges (h, range, N_BINS + 1);
689 double expected[N_BINS];
695 for (uint32_t i = 0; i < N_BINS; ++i)
697 expected[i] = gsl_cdf_exponential_P (range[i + 1], mu) - gsl_cdf_exponential_P (range[i], mu);
698 expected[i] *= N_MEASUREMENTS;
701 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
703 gsl_histogram_increment (h, e->
GetValue ());
708 for (uint32_t i = 0; i < N_BINS; ++i)
710 tmp[i] = gsl_histogram_get (h, i);
711 tmp[i] -= expected[i];
713 tmp[i] /= expected[i];
716 gsl_histogram_free (h);
718 double chiSquared = 0;
720 for (uint32_t i = 0; i < N_BINS; ++i)
722 chiSquared += tmp[i];
731 SeedManager::SetSeed (time (0));
734 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
736 for (uint32_t i = 0; i < N_RUNS; ++i)
739 double result = ChiSquaredTest (e);
743 sum /= (double)N_RUNS;
745 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
758 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
763 double valueMean = sum / N_MEASUREMENTS;
766 double TOLERANCE = mean * 1e-2;
767 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, mean, TOLERANCE,
"Wrong mean value.");
776 static const uint32_t N_RUNS = 5;
777 static const uint32_t N_BINS = 50;
778 static const uint32_t N_MEASUREMENTS = 1000000;
786 virtual void DoRun (
void);
789 RandomVariableStreamExponentialAntitheticTestCase::RandomVariableStreamExponentialAntitheticTestCase ()
790 :
TestCase (
"Antithetic Exponential Random Variable Stream Generator")
794 RandomVariableStreamExponentialAntitheticTestCase::~RandomVariableStreamExponentialAntitheticTestCase ()
801 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
803 double range[N_BINS + 1];
804 FillHistoRangeUniformly (range, N_BINS + 1, 0., 10.);
805 range[N_BINS] = std::numeric_limits<double>::max ();
807 gsl_histogram_set_ranges (h, range, N_BINS + 1);
809 double expected[N_BINS];
815 for (uint32_t i = 0; i < N_BINS; ++i)
817 expected[i] = gsl_cdf_exponential_P (range[i + 1], mu) - gsl_cdf_exponential_P (range[i], mu);
818 expected[i] *= N_MEASUREMENTS;
821 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
823 gsl_histogram_increment (h, e->
GetValue ());
828 for (uint32_t i = 0; i < N_BINS; ++i)
830 tmp[i] = gsl_histogram_get (h, i);
831 tmp[i] -= expected[i];
833 tmp[i] /= expected[i];
836 gsl_histogram_free (h);
838 double chiSquared = 0;
840 for (uint32_t i = 0; i < N_BINS; ++i)
842 chiSquared += tmp[i];
851 SeedManager::SetSeed (time (0));
854 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
856 for (uint32_t i = 0; i < N_RUNS; ++i)
863 double result = ChiSquaredTest (e);
867 sum /= (double)N_RUNS;
869 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
885 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
890 double valueMean = sum / N_MEASUREMENTS;
893 double TOLERANCE = mean * 1e-2;
894 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, mean, TOLERANCE,
"Wrong mean value.");
903 static const uint32_t N_RUNS = 5;
904 static const uint32_t N_BINS = 50;
905 static const uint32_t N_MEASUREMENTS = 1000000;
913 virtual void DoRun (
void);
916 RandomVariableStreamParetoTestCase::RandomVariableStreamParetoTestCase ()
917 :
TestCase (
"Pareto Random Variable Stream Generator")
921 RandomVariableStreamParetoTestCase::~RandomVariableStreamParetoTestCase ()
928 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
930 double range[N_BINS + 1];
931 FillHistoRangeUniformly (range, N_BINS + 1, 1., 10.);
932 range[N_BINS] = std::numeric_limits<double>::max ();
934 gsl_histogram_set_ranges (h, range, N_BINS + 1);
936 double expected[N_BINS];
942 double scale = mean * (shape - 1.0) / shape;
944 for (uint32_t i = 0; i < N_BINS; ++i)
946 expected[i] = gsl_cdf_pareto_P (range[i + 1], shape, scale) - gsl_cdf_pareto_P (range[i], shape, scale);
947 expected[i] *= N_MEASUREMENTS;
950 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
952 gsl_histogram_increment (h, p->GetValue ());
957 for (uint32_t i = 0; i < N_BINS; ++i)
959 tmp[i] = gsl_histogram_get (h, i);
960 tmp[i] -= expected[i];
962 tmp[i] /= expected[i];
965 gsl_histogram_free (h);
967 double chiSquared = 0;
969 for (uint32_t i = 0; i < N_BINS; ++i)
971 chiSquared += tmp[i];
980 SeedManager::SetSeed (time (0));
983 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
985 for (uint32_t i = 0; i < N_RUNS; ++i)
988 double result = ChiSquaredTest (e);
992 sum /= (double)N_RUNS;
994 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
998 double scale = mean * (shape - 1.0) / shape;
1008 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1013 double valueMean = sum / N_MEASUREMENTS;
1024 double expectedMean = (shape * scale) / (shape - 1.0);
1027 double TOLERANCE = expectedMean * 1e-2;
1028 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
1037 static const uint32_t N_RUNS = 5;
1038 static const uint32_t N_BINS = 50;
1039 static const uint32_t N_MEASUREMENTS = 1000000;
1047 virtual void DoRun (
void);
1050 RandomVariableStreamParetoAntitheticTestCase::RandomVariableStreamParetoAntitheticTestCase ()
1051 :
TestCase (
"Antithetic Pareto Random Variable Stream Generator")
1055 RandomVariableStreamParetoAntitheticTestCase::~RandomVariableStreamParetoAntitheticTestCase ()
1062 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
1064 double range[N_BINS + 1];
1065 FillHistoRangeUniformly (range, N_BINS + 1, 1., 10.);
1066 range[N_BINS] = std::numeric_limits<double>::max ();
1068 gsl_histogram_set_ranges (h, range, N_BINS + 1);
1070 double expected[N_BINS];
1076 double scale = mean * (shape - 1.0) / shape;
1078 for (uint32_t i = 0; i < N_BINS; ++i)
1080 expected[i] = gsl_cdf_pareto_P (range[i + 1], shape, scale) - gsl_cdf_pareto_P (range[i], shape, scale);
1081 expected[i] *= N_MEASUREMENTS;
1084 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1086 gsl_histogram_increment (h, p->GetValue ());
1091 for (uint32_t i = 0; i < N_BINS; ++i)
1093 tmp[i] = gsl_histogram_get (h, i);
1094 tmp[i] -= expected[i];
1096 tmp[i] /= expected[i];
1099 gsl_histogram_free (h);
1101 double chiSquared = 0;
1103 for (uint32_t i = 0; i < N_BINS; ++i)
1105 chiSquared += tmp[i];
1114 SeedManager::SetSeed (time (0));
1117 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
1119 for (uint32_t i = 0; i < N_RUNS; ++i)
1126 double result = ChiSquaredTest (e);
1130 sum /= (double)N_RUNS;
1132 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
1136 double scale = mean * (shape - 1.0) / shape;
1149 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1154 double valueMean = sum / N_MEASUREMENTS;
1166 double expectedMean = (shape * scale) / (shape - 1.0);
1169 double TOLERANCE = expectedMean * 1e-2;
1170 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
1179 static const uint32_t N_RUNS = 5;
1180 static const uint32_t N_BINS = 50;
1181 static const uint32_t N_MEASUREMENTS = 1000000;
1189 virtual void DoRun (
void);
1192 RandomVariableStreamWeibullTestCase::RandomVariableStreamWeibullTestCase ()
1193 :
TestCase (
"Weibull Random Variable Stream Generator")
1197 RandomVariableStreamWeibullTestCase::~RandomVariableStreamWeibullTestCase ()
1204 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
1206 double range[N_BINS + 1];
1207 FillHistoRangeUniformly (range, N_BINS + 1, 1., 10.);
1208 range[N_BINS] = std::numeric_limits<double>::max ();
1210 gsl_histogram_set_ranges (h, range, N_BINS + 1);
1212 double expected[N_BINS];
1220 for (uint32_t i = 0; i < N_BINS; ++i)
1222 expected[i] = gsl_cdf_weibull_P (range[i + 1], a, b) - gsl_cdf_weibull_P (range[i], a, b);
1223 expected[i] *= N_MEASUREMENTS;
1226 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1228 gsl_histogram_increment (h, p->
GetValue ());
1233 for (uint32_t i = 0; i < N_BINS; ++i)
1235 tmp[i] = gsl_histogram_get (h, i);
1236 tmp[i] -= expected[i];
1238 tmp[i] /= expected[i];
1241 gsl_histogram_free (h);
1243 double chiSquared = 0;
1245 for (uint32_t i = 0; i < N_BINS; ++i)
1247 chiSquared += tmp[i];
1256 SeedManager::SetSeed (time (0));
1259 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
1261 for (uint32_t i = 0; i < N_RUNS; ++i)
1264 double result = ChiSquaredTest (e);
1268 sum /= (double)N_RUNS;
1270 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
1283 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1288 double valueMean = sum / N_MEASUREMENTS;
1312 double expectedMean = scale;
1315 double TOLERANCE = expectedMean * 1e-2;
1316 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
1325 static const uint32_t N_RUNS = 5;
1326 static const uint32_t N_BINS = 50;
1327 static const uint32_t N_MEASUREMENTS = 1000000;
1335 virtual void DoRun (
void);
1338 RandomVariableStreamWeibullAntitheticTestCase::RandomVariableStreamWeibullAntitheticTestCase ()
1339 :
TestCase (
"Antithetic Weibull Random Variable Stream Generator")
1343 RandomVariableStreamWeibullAntitheticTestCase::~RandomVariableStreamWeibullAntitheticTestCase ()
1350 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
1352 double range[N_BINS + 1];
1353 FillHistoRangeUniformly (range, N_BINS + 1, 1., 10.);
1354 range[N_BINS] = std::numeric_limits<double>::max ();
1356 gsl_histogram_set_ranges (h, range, N_BINS + 1);
1358 double expected[N_BINS];
1366 for (uint32_t i = 0; i < N_BINS; ++i)
1368 expected[i] = gsl_cdf_weibull_P (range[i + 1], a, b) - gsl_cdf_weibull_P (range[i], a, b);
1369 expected[i] *= N_MEASUREMENTS;
1372 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1374 gsl_histogram_increment (h, p->
GetValue ());
1379 for (uint32_t i = 0; i < N_BINS; ++i)
1381 tmp[i] = gsl_histogram_get (h, i);
1382 tmp[i] -= expected[i];
1384 tmp[i] /= expected[i];
1387 gsl_histogram_free (h);
1389 double chiSquared = 0;
1391 for (uint32_t i = 0; i < N_BINS; ++i)
1393 chiSquared += tmp[i];
1402 SeedManager::SetSeed (time (0));
1405 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
1407 for (uint32_t i = 0; i < N_RUNS; ++i)
1414 double result = ChiSquaredTest (e);
1418 sum /= (double)N_RUNS;
1420 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
1436 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1441 double valueMean = sum / N_MEASUREMENTS;
1465 double expectedMean = scale;
1468 double TOLERANCE = expectedMean * 1e-2;
1469 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
1478 static const uint32_t N_RUNS = 5;
1479 static const uint32_t N_BINS = 50;
1480 static const uint32_t N_MEASUREMENTS = 1000000;
1488 virtual void DoRun (
void);
1491 RandomVariableStreamLogNormalTestCase::RandomVariableStreamLogNormalTestCase ()
1492 :
TestCase (
"Log-Normal Random Variable Stream Generator")
1496 RandomVariableStreamLogNormalTestCase::~RandomVariableStreamLogNormalTestCase ()
1503 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
1505 double range[N_BINS + 1];
1506 FillHistoRangeUniformly (range, N_BINS + 1, 0., 10.);
1507 range[N_BINS] = std::numeric_limits<double>::max ();
1509 gsl_histogram_set_ranges (h, range, N_BINS + 1);
1511 double expected[N_BINS];
1519 for (uint32_t i = 0; i < N_BINS; ++i)
1521 expected[i] = gsl_cdf_lognormal_P (range[i + 1], mu, sigma) - gsl_cdf_lognormal_P (range[i], mu, sigma);
1522 expected[i] *= N_MEASUREMENTS;
1525 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1527 gsl_histogram_increment (h, n->
GetValue ());
1532 for (uint32_t i = 0; i < N_BINS; ++i)
1534 tmp[i] = gsl_histogram_get (h, i);
1535 tmp[i] -= expected[i];
1537 tmp[i] /= expected[i];
1540 gsl_histogram_free (h);
1542 double chiSquared = 0;
1544 for (uint32_t i = 0; i < N_BINS; ++i)
1546 chiSquared += tmp[i];
1555 SeedManager::SetSeed (time (0));
1558 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
1560 for (uint32_t i = 0; i < N_RUNS; ++i)
1563 double result = ChiSquaredTest (n);
1567 sum /= (double)N_RUNS;
1569 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
1582 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1587 double valueMean = sum / N_MEASUREMENTS;
1596 double expectedMean = std::exp(mu + sigma * sigma / 2.0);
1604 double TOLERANCE = expectedMean * 3e-2;
1605 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
1614 static const uint32_t N_RUNS = 5;
1615 static const uint32_t N_BINS = 50;
1616 static const uint32_t N_MEASUREMENTS = 1000000;
1624 virtual void DoRun (
void);
1627 RandomVariableStreamLogNormalAntitheticTestCase::RandomVariableStreamLogNormalAntitheticTestCase ()
1628 :
TestCase (
"Antithetic Log-Normal Random Variable Stream Generator")
1632 RandomVariableStreamLogNormalAntitheticTestCase::~RandomVariableStreamLogNormalAntitheticTestCase ()
1639 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
1641 double range[N_BINS + 1];
1642 FillHistoRangeUniformly (range, N_BINS + 1, 0., 10.);
1643 range[N_BINS] = std::numeric_limits<double>::max ();
1645 gsl_histogram_set_ranges (h, range, N_BINS + 1);
1647 double expected[N_BINS];
1655 for (uint32_t i = 0; i < N_BINS; ++i)
1657 expected[i] = gsl_cdf_lognormal_P (range[i + 1], mu, sigma) - gsl_cdf_lognormal_P (range[i], mu, sigma);
1658 expected[i] *= N_MEASUREMENTS;
1661 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1663 gsl_histogram_increment (h, n->
GetValue ());
1668 for (uint32_t i = 0; i < N_BINS; ++i)
1670 tmp[i] = gsl_histogram_get (h, i);
1671 tmp[i] -= expected[i];
1673 tmp[i] /= expected[i];
1676 gsl_histogram_free (h);
1678 double chiSquared = 0;
1680 for (uint32_t i = 0; i < N_BINS; ++i)
1682 chiSquared += tmp[i];
1691 SeedManager::SetSeed (time (0));
1694 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
1696 for (uint32_t i = 0; i < N_RUNS; ++i)
1703 double result = ChiSquaredTest (n);
1707 sum /= (double)N_RUNS;
1709 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
1725 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1730 double valueMean = sum / N_MEASUREMENTS;
1739 double expectedMean = std::exp(mu + sigma * sigma / 2.0);
1747 double TOLERANCE = expectedMean * 3e-2;
1748 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
1757 static const uint32_t N_RUNS = 5;
1758 static const uint32_t N_BINS = 50;
1759 static const uint32_t N_MEASUREMENTS = 1000000;
1767 virtual void DoRun (
void);
1770 RandomVariableStreamGammaTestCase::RandomVariableStreamGammaTestCase ()
1771 :
TestCase (
"Gamma Random Variable Stream Generator")
1775 RandomVariableStreamGammaTestCase::~RandomVariableStreamGammaTestCase ()
1782 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
1784 double range[N_BINS + 1];
1785 FillHistoRangeUniformly (range, N_BINS + 1, 0., 10.);
1786 range[N_BINS] = std::numeric_limits<double>::max ();
1788 gsl_histogram_set_ranges (h, range, N_BINS + 1);
1790 double expected[N_BINS];
1798 for (uint32_t i = 0; i < N_BINS; ++i)
1800 expected[i] = gsl_cdf_gamma_P (range[i + 1], alpha, beta) - gsl_cdf_gamma_P (range[i], alpha, beta);
1801 expected[i] *= N_MEASUREMENTS;
1804 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1806 gsl_histogram_increment (h, n->
GetValue ());
1811 for (uint32_t i = 0; i < N_BINS; ++i)
1813 tmp[i] = gsl_histogram_get (h, i);
1814 tmp[i] -= expected[i];
1816 tmp[i] /= expected[i];
1819 gsl_histogram_free (h);
1821 double chiSquared = 0;
1823 for (uint32_t i = 0; i < N_BINS; ++i)
1825 chiSquared += tmp[i];
1834 SeedManager::SetSeed (time (0));
1837 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
1839 for (uint32_t i = 0; i < N_RUNS; ++i)
1842 double result = ChiSquaredTest (n);
1846 sum /= (double)N_RUNS;
1848 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
1861 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1866 double valueMean = sum / N_MEASUREMENTS;
1873 double expectedMean = alpha * beta;
1876 double TOLERANCE = expectedMean * 1e-2;
1877 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
1886 static const uint32_t N_RUNS = 5;
1887 static const uint32_t N_BINS = 50;
1888 static const uint32_t N_MEASUREMENTS = 1000000;
1896 virtual void DoRun (
void);
1899 RandomVariableStreamGammaAntitheticTestCase::RandomVariableStreamGammaAntitheticTestCase ()
1900 :
TestCase (
"Antithetic Gamma Random Variable Stream Generator")
1904 RandomVariableStreamGammaAntitheticTestCase::~RandomVariableStreamGammaAntitheticTestCase ()
1911 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
1913 double range[N_BINS + 1];
1914 FillHistoRangeUniformly (range, N_BINS + 1, 0., 10.);
1915 range[N_BINS] = std::numeric_limits<double>::max ();
1917 gsl_histogram_set_ranges (h, range, N_BINS + 1);
1919 double expected[N_BINS];
1927 for (uint32_t i = 0; i < N_BINS; ++i)
1929 expected[i] = gsl_cdf_gamma_P (range[i + 1], alpha, beta) - gsl_cdf_gamma_P (range[i], alpha, beta);
1930 expected[i] *= N_MEASUREMENTS;
1933 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
1935 gsl_histogram_increment (h, n->
GetValue ());
1940 for (uint32_t i = 0; i < N_BINS; ++i)
1942 tmp[i] = gsl_histogram_get (h, i);
1943 tmp[i] -= expected[i];
1945 tmp[i] /= expected[i];
1948 gsl_histogram_free (h);
1950 double chiSquared = 0;
1952 for (uint32_t i = 0; i < N_BINS; ++i)
1954 chiSquared += tmp[i];
1963 SeedManager::SetSeed (time (0));
1966 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
1968 for (uint32_t i = 0; i < N_RUNS; ++i)
1975 double result = ChiSquaredTest (n);
1979 sum /= (double)N_RUNS;
1981 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
1998 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
2003 double valueMean = sum / N_MEASUREMENTS;
2010 double expectedMean = alpha * beta;
2013 double TOLERANCE = expectedMean * 1e-2;
2014 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
2023 static const uint32_t N_RUNS = 5;
2024 static const uint32_t N_BINS = 50;
2025 static const uint32_t N_MEASUREMENTS = 1000000;
2033 virtual void DoRun (
void);
2036 RandomVariableStreamErlangTestCase::RandomVariableStreamErlangTestCase ()
2037 :
TestCase (
"Erlang Random Variable Stream Generator")
2041 RandomVariableStreamErlangTestCase::~RandomVariableStreamErlangTestCase ()
2048 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
2050 double range[N_BINS + 1];
2051 FillHistoRangeUniformly (range, N_BINS + 1, 0., 10.);
2052 range[N_BINS] = std::numeric_limits<double>::max ();
2054 gsl_histogram_set_ranges (h, range, N_BINS + 1);
2056 double expected[N_BINS];
2062 double lambda = 1.0;
2067 for (uint32_t i = 0; i < N_BINS; ++i)
2069 expected[i] = gsl_cdf_gamma_P (range[i + 1], k, lambda) - gsl_cdf_gamma_P (range[i], k, lambda);
2070 expected[i] *= N_MEASUREMENTS;
2073 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
2075 gsl_histogram_increment (h, n->
GetValue ());
2080 for (uint32_t i = 0; i < N_BINS; ++i)
2082 tmp[i] = gsl_histogram_get (h, i);
2083 tmp[i] -= expected[i];
2085 tmp[i] /= expected[i];
2088 gsl_histogram_free (h);
2090 double chiSquared = 0;
2092 for (uint32_t i = 0; i < N_BINS; ++i)
2094 chiSquared += tmp[i];
2103 SeedManager::SetSeed (time (0));
2106 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
2108 for (uint32_t i = 0; i < N_RUNS; ++i)
2111 double result = ChiSquaredTest (n);
2115 sum /= (double)N_RUNS;
2117 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
2120 double lambda = 2.0;
2130 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
2135 double valueMean = sum / N_MEASUREMENTS;
2142 double expectedMean = k * lambda;
2145 double TOLERANCE = expectedMean * 1e-2;
2146 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
2155 static const uint32_t N_RUNS = 5;
2156 static const uint32_t N_BINS = 50;
2157 static const uint32_t N_MEASUREMENTS = 1000000;
2165 virtual void DoRun (
void);
2168 RandomVariableStreamErlangAntitheticTestCase::RandomVariableStreamErlangAntitheticTestCase ()
2169 :
TestCase (
"Antithetic Erlang Random Variable Stream Generator")
2173 RandomVariableStreamErlangAntitheticTestCase::~RandomVariableStreamErlangAntitheticTestCase ()
2180 gsl_histogram * h = gsl_histogram_alloc (N_BINS);
2182 double range[N_BINS + 1];
2183 FillHistoRangeUniformly (range, N_BINS + 1, 0., 10.);
2184 range[N_BINS] = std::numeric_limits<double>::max ();
2186 gsl_histogram_set_ranges (h, range, N_BINS + 1);
2188 double expected[N_BINS];
2194 double lambda = 1.0;
2199 for (uint32_t i = 0; i < N_BINS; ++i)
2201 expected[i] = gsl_cdf_gamma_P (range[i + 1], k, lambda) - gsl_cdf_gamma_P (range[i], k, lambda);
2202 expected[i] *= N_MEASUREMENTS;
2205 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
2207 gsl_histogram_increment (h, n->
GetValue ());
2212 for (uint32_t i = 0; i < N_BINS; ++i)
2214 tmp[i] = gsl_histogram_get (h, i);
2215 tmp[i] -= expected[i];
2217 tmp[i] /= expected[i];
2220 gsl_histogram_free (h);
2222 double chiSquared = 0;
2224 for (uint32_t i = 0; i < N_BINS; ++i)
2226 chiSquared += tmp[i];
2235 SeedManager::SetSeed (time (0));
2238 double maxStatistic = gsl_cdf_chisq_Qinv (0.05, N_BINS);
2240 for (uint32_t i = 0; i < N_RUNS; ++i)
2247 double result = ChiSquaredTest (n);
2251 sum /= (double)N_RUNS;
2253 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic,
"Chi-squared statistic out of range");
2256 double lambda = 2.0;
2270 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
2275 double valueMean = sum / N_MEASUREMENTS;
2282 double expectedMean = k * lambda;
2285 double TOLERANCE = expectedMean * 1e-2;
2286 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
2295 static const uint32_t N_MEASUREMENTS = 1000000;
2301 virtual void DoRun (
void);
2304 RandomVariableStreamZipfTestCase::RandomVariableStreamZipfTestCase ()
2305 :
TestCase (
"Zipf Random Variable Stream Generator")
2309 RandomVariableStreamZipfTestCase::~RandomVariableStreamZipfTestCase ()
2316 SeedManager::SetSeed (time (0));
2329 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
2334 double valueMean = sum / N_MEASUREMENTS;
2364 double expectedMean = 1.0;
2367 double TOLERANCE = expectedMean * 1e-2;
2368 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
2377 static const uint32_t N_MEASUREMENTS = 1000000;
2383 virtual void DoRun (
void);
2386 RandomVariableStreamZipfAntitheticTestCase::RandomVariableStreamZipfAntitheticTestCase ()
2387 :
TestCase (
"Antithetic Zipf Random Variable Stream Generator")
2391 RandomVariableStreamZipfAntitheticTestCase::~RandomVariableStreamZipfAntitheticTestCase ()
2398 SeedManager::SetSeed (time (0));
2414 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
2419 double valueMean = sum / N_MEASUREMENTS;
2449 double expectedMean = 1.0;
2452 double TOLERANCE = expectedMean * 1e-2;
2453 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
2462 static const uint32_t N_MEASUREMENTS = 1000000;
2468 virtual void DoRun (
void);
2471 RandomVariableStreamZetaTestCase::RandomVariableStreamZetaTestCase ()
2472 :
TestCase (
"Zeta Random Variable Stream Generator")
2476 RandomVariableStreamZetaTestCase::~RandomVariableStreamZetaTestCase ()
2483 SeedManager::SetSeed (time (0));
2494 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
2499 double valueMean = sum / N_MEASUREMENTS;
2513 double expectedMean = gsl_sf_zeta_int (alpha - 1) / gsl_sf_zeta_int (alpha);
2516 double TOLERANCE = expectedMean * 1e-2;
2517 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
2526 static const uint32_t N_MEASUREMENTS = 1000000;
2532 virtual void DoRun (
void);
2535 RandomVariableStreamZetaAntitheticTestCase::RandomVariableStreamZetaAntitheticTestCase ()
2536 :
TestCase (
"Antithetic Zeta Random Variable Stream Generator")
2540 RandomVariableStreamZetaAntitheticTestCase::~RandomVariableStreamZetaAntitheticTestCase ()
2547 SeedManager::SetSeed (time (0));
2561 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
2566 double valueMean = sum / N_MEASUREMENTS;
2580 double expectedMean = gsl_sf_zeta_int (alpha - 1) / gsl_sf_zeta_int (alpha);
2583 double TOLERANCE = expectedMean * 1e-2;
2584 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
2593 static const double TOLERANCE = 1e-8;
2599 virtual void DoRun (
void);
2602 RandomVariableStreamDeterministicTestCase::RandomVariableStreamDeterministicTestCase ()
2603 :
TestCase (
"Deterministic Random Variable Stream Generator")
2607 RandomVariableStreamDeterministicTestCase::~RandomVariableStreamDeterministicTestCase ()
2614 SeedManager::SetSeed (time (0));
2622 double array1 [] = { 4, 4, 7, 7, 10, 10};
2623 uint64_t count1 = 6;
2630 NS_TEST_ASSERT_MSG_EQ_TOL (value, 4, TOLERANCE,
"Sequence 1 value 1 wrong.");
2632 NS_TEST_ASSERT_MSG_EQ_TOL (value, 4, TOLERANCE,
"Sequence 1 value 2 wrong.");
2634 NS_TEST_ASSERT_MSG_EQ_TOL (value, 7, TOLERANCE,
"Sequence 1 value 3 wrong.");
2636 NS_TEST_ASSERT_MSG_EQ_TOL (value, 7, TOLERANCE,
"Sequence 1 value 4 wrong.");
2638 NS_TEST_ASSERT_MSG_EQ_TOL (value, 10, TOLERANCE,
"Sequence 1 value 5 wrong.");
2640 NS_TEST_ASSERT_MSG_EQ_TOL (value, 10, TOLERANCE,
"Sequence 1 value 6 wrong.");
2646 double array2 [] = { 1000, 2000, 3000, 4000};
2647 uint64_t count2 = 4;
2652 NS_TEST_ASSERT_MSG_EQ_TOL (value, 1000, TOLERANCE,
"Sequence 2 value 1 wrong.");
2654 NS_TEST_ASSERT_MSG_EQ_TOL (value, 2000, TOLERANCE,
"Sequence 2 value 2 wrong.");
2656 NS_TEST_ASSERT_MSG_EQ_TOL (value, 3000, TOLERANCE,
"Sequence 2 value 3 wrong.");
2658 NS_TEST_ASSERT_MSG_EQ_TOL (value, 4000, TOLERANCE,
"Sequence 2 value 4 wrong.");
2668 static const uint32_t N_MEASUREMENTS = 1000000;
2674 virtual void DoRun (
void);
2677 RandomVariableStreamEmpiricalTestCase::RandomVariableStreamEmpiricalTestCase ()
2678 :
TestCase (
"Empirical Random Variable Stream Generator")
2682 RandomVariableStreamEmpiricalTestCase::~RandomVariableStreamEmpiricalTestCase ()
2689 SeedManager::SetSeed (time (0));
2700 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
2705 double valueMean = sum / N_MEASUREMENTS;
2712 double expectedMean = 5.0;
2715 double TOLERANCE = expectedMean * 1e-2;
2716 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
2725 static const uint32_t N_MEASUREMENTS = 1000000;
2731 virtual void DoRun (
void);
2734 RandomVariableStreamEmpiricalAntitheticTestCase::RandomVariableStreamEmpiricalAntitheticTestCase ()
2735 :
TestCase (
"EmpiricalAntithetic Random Variable Stream Generator")
2739 RandomVariableStreamEmpiricalAntitheticTestCase::~RandomVariableStreamEmpiricalAntitheticTestCase ()
2746 SeedManager::SetSeed (time (0));
2760 for (uint32_t i = 0; i < N_MEASUREMENTS; ++i)
2765 double valueMean = sum / N_MEASUREMENTS;
2772 double expectedMean = 5.0;
2775 double TOLERANCE = expectedMean * 1e-2;
2776 NS_TEST_ASSERT_MSG_EQ_TOL (valueMean, expectedMean, TOLERANCE,
"Wrong mean value.");
2785 RandomVariableStreamTestSuite::RandomVariableStreamTestSuite ()
2786 :
TestSuite (
"random-variable-stream-generators", UNIT)
virtual double GetValue(void)
Returns the next value in the empirical distribution.
double GetValue(double constant)
Returns the value passed in.
hold variables of type string
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.
double GetValue(double mean, double shape, double bound)
Returns a random double from a Pareto distribution with the specified mean, shape, and upper bound.
virtual void DoRun(void)
Implementation to actually run this test case.
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.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual double GetValue(void)
Returns the next value in the sequence returned by this RNG stream.
virtual double GetValue(void)
Returns the next value in the sequence.
virtual void DoRun(void)
Implementation to actually run this test case.
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 void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
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 test case.
void SetValueArray(double *values, uint64_t length)
Sets the array of values that holds the predetermined sequence.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
double GetValue(double mean, double bound)
Returns a random double from an exponential distribution with the specified mean and upper bound...
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
virtual void DoRun(void)
Implementation to actually run this test case.
double GetValue(uint32_t n, double alpha)
Returns a random double from a Zipf distribution with the specified n and alpha.
Hold an floating point type.
void SetAttribute(std::string name, const AttributeValue &value)
virtual void DoRun(void)
Implementation to actually run this test case.
double GetValue(double scale, double shape, double bound)
Returns a random double from a Weibull distribution with the specified scale, shape, and upper bound.