Probabilistic choice: Difference between revisions
Content added Content deleted
No edit summary |
m (added a comma to the task's preamble.) |
||
Line 2: | Line 2: | ||
Given a mapping between items and their required probability of occurrence, generate a million items ''randomly'' subject to the given probabilities and compare the target probability of occurrence versus the generated values. |
Given a mapping between items and their required probability of occurrence, generate a million items ''randomly'' subject to the given probabilities and compare the target probability of occurrence versus the generated values. |
||
The total of all the probabilities should equal one. (Because floating point arithmetic is involved this is subject to rounding errors). |
The total of all the probabilities should equal one. (Because floating point arithmetic is involved, this is subject to rounding errors). |
||
Use the following mapping to test your programs:<pre> |
Use the following mapping to test your programs:<pre> |