Example program illustrating use of ns3::EmpiricalRandomVariable. More...
Functions | |
| void | PrintStatsLine (const double value, const long count, const long n, const long sum) |
| Prints a stat line. | |
| void | PrintSummary (long sum, long n, double weighted, double expected) |
| Prints the summary. | |
| void | RunBothModes (std::string mode, Ptr< EmpiricalRandomVariable > erv, long n) |
| Sample the random variable. | |
| void | RunSingleSample (std::string mode, Ptr< EmpiricalRandomVariable > erv) |
| Sample the random variable only once. | |
Example program illustrating use of ns3::EmpiricalRandomVariable.
This example illustrates
Consult the ns-3 manual for more information about the use of the random number generator
| void PrintStatsLine | ( | const double | value, |
| const long | count, | ||
| const long | n, | ||
| const long | sum | ||
| ) |
Prints a stat line.
| value | The value to print. |
| count | The number of times that value has been sampled. |
| n | The total number of random values sampled. |
| sum | The sum of the counts seen up to value, used to show the CDF for value. |
Definition at line 89 of file empirical-random-variable-example.cc.
Referenced by RunBothModes().
Here is the caller graph for this function:Prints the summary.
| sum | The number of sampled values. |
| n | The total number of random values to be drawn. |
| weighted | The average of the sample. |
| expected | The expected average of the sample. |
Definition at line 107 of file empirical-random-variable-example.cc.
Referenced by RunBothModes().
Here is the caller graph for this function:| void RunBothModes | ( | std::string | mode, |
| Ptr< EmpiricalRandomVariable > | erv, | ||
| long | n | ||
| ) |
Sample the random variable.
| mode | Rng mode (Normal or Antithetic). |
| erv | The empirical random variable. |
| n | Number of samples to draw. |
Definition at line 129 of file empirical-random-variable-example.cc.
References ns3::Histogram::AddValue(), ns3::Histogram::GetBinCount(), ns3::Histogram::GetBinStart(), ns3::Histogram::GetBinWidth(), ns3::Histogram::GetNBins(), PrintStatsLine(), and PrintSummary().
Here is the call graph for this function:| void RunSingleSample | ( | std::string | mode, |
| Ptr< EmpiricalRandomVariable > | erv | ||
| ) |
Sample the random variable only once.
| mode | Rng mode (Normal or Antithetic). |
| erv | The empirical random variable. |
Definition at line 60 of file empirical-random-variable-example.cc.