![]() |
Exponential Distribution Checker
A Program that Runs Experiments on Generating Random Numbers with an Exponential Distribution
|
Main. More...
Functions | |
| void | ResetDistribution () |
| Reset the measured distribution. | |
| void | RunExperiment (float omega, int n) |
| Run an experiment. | |
| void | SaveDistribution (FILE *filehandle) |
| Save. | |
| void | CheckDistribution () |
| Check the frequency distribution and report to console. | |
| int | main (int argc, char *argv[]) |
| Main. | |
Variables | |
| const int | GRANULARITY = 100 |
| Granularity at which to measure the distribution. | |
| const int | REPEATS = 10000000 |
| Number of times we repeat the experiment. | |
| int | g_nDistribution [GRANULARITY] |
| Experimental frequency distribution. | |
| int | g_nMissedSmall |
| How many experiments were too small (should be 0). | |
| int | g_nMissedLarge |
| How many experiments were too large (should be 0). | |
| float | g_fMin |
| Smallest value found (ideally close to 0). | |
| float | g_fMax |
| Largest value found (ideally close to 1). | |
| void CheckDistribution | ( | ) |
Check the frequency distribution and report interesting things to console.
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Prompts the user for a random number seed and a tail multiplier, then measures statistics, and saves information about the distribution to a file.
| argc | Argument count |
| argv | Arguments. |
| void ResetDistribution | ( | ) |
Reset all the statistics to zero. Call this before you start measuring.
| void RunExperiment | ( | float | omega, |
| int | n | ||
| ) |
Run an experiment to measure the frequency distribution.
| omega | The tail multiplier, which controls how low the tails of the distribution can be. |
| n | Number of times to repeat the experiment. |
| void SaveDistribution | ( | FILE * | filehandle | ) |
Save the frequency distribution.
| filehandle | File handle opened for writing. |
1.8.2