Collaboration diagram for Core example: Empirical random variables use.:Files | |
| file | empirical-random-variable-example.cc |
| Example program illustrating use of ns3::EmpiricalRandomVariable. | |
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. | |
| 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 82 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 100 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 122 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 53 of file empirical-random-variable-example.cc.