core: (fixes #143): EmpiricalRandomVariable should ensure that the CDF ends with 1.0

After discussion it was decided that this is not an error,
but should be better documented.
This commit is contained in:
Peter D. Barnes, Jr
2020-04-03 11:12:41 -07:00
committed by Peter Barnes
parent b7deb42a65
commit fa7d6a894e
2 changed files with 13 additions and 3 deletions

View File

@@ -32,6 +32,7 @@ New user-visible features
Bugs fixed
----------
- core: Bug 143 EmpiricalRandomVariable should ensure that the CDF ends with 1.0
- wifi: a zero value for the backoff timer might be discarded and a new value
might be generated by an erroneous call to NotifyCollision().
- Bug 2636 - Add to doxygen a list of all registered TypeIds

View File

@@ -2407,11 +2407,12 @@ private:
* empirical distribution.
*
* Defines a random variable that has a specified, empirical
* distribution. The distribution is specified by a
* distribution. The cumulative probability distribution function (CDF)
* is specified by a
* series of calls to the CDF() member function, specifying a
* value and the probability that the function value is less than
* value and the probability that the distribution is less than
* the specified value. When random values are requested,
* a uniform random variable is used to select a probability,
* a uniform random variable `r` is used to select a probability,
* and the return value is chosen from the largest input value with CDF
* less than the random value. The method is known
* as inverse transform sampling:
@@ -2437,6 +2438,14 @@ private:
* set the mode to sampling, then use the GetValue() function for
* sampled values, and Interpolate() function for interpolated values.
*
* The CDF need not start with a probability of zero,
* nor end with a probability of 1.0. If the selected uniform
* random value `r` is less than the first CDF point, that point
* is selected. If `r` is greater than the last CDF point the last
* point is selected. In either case the interpolating mode will *not*
* interpolate (since there is no value beyond `r` to work with), but
* simply return the extremal CDF value, as in sampling.
*
* Here is an example of how to use this class:
*
* // Create the RNG with a non-uniform distribution between 0 and 10.