Quality of Random Number Generators - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Math Apps : Probability and Statistics : Statistics : MathApps/RandomNumberGeneratorQuality

Quality of Random Number Generators

Main Concept

In this demonstration, you see just how random a random number generator is. Each time you click 'Generate Numbers', a random number generator will generate a set of 100 random numbers between 1 and 100.

 

The number lines below will indicate how many of the numbers that were generated were less than or equal to 50 in comparison to how many of the numbers were above 50 at that click; negative numbers indicate that numbers less than or equal to 50 were generated more often than numbers greater than 50. The histograms will keep track of how many times each number was generated throughout all of the clicks.

 

Each bar in the histograms below correspond to the number of repetitions for each value from 1 to 100.  This is an example of a multinomial distribution ; each time the 'Generate Numbers' button is pushed, 100 trials are run that result in a success in exactly one of the categories for each trial.

 

To test the quality of each of the random number generators, we can apply a multinomial test to determine if the null hypothesis that the parameters of a multinomial distribution are equal to specified values is correct. Since we are testing with relatively larger sample sizes, there are two approximations for multinomial tests that are relevant to determining the quality of each of the number generators: the likelihood ratio test  and Pearson's chi-square test . As the number of trials increases, if the null hypothesis is true, then the distribution of the likelihood ratio test should converge to the chi-square test, however it is worth noting that the moments of the likelihood ratio test are known to be greater than those of the chi-square test (reference: Lawley, 1956).

 

Moreover, when run with a "good" random number generator (i.e., when the null hypothesis is satisfied), the p-values behave like elements drawn uniformly from [0, 1] when you iterate the experiments. With a "bad" random number generator, the p-values should always be small (less than a given critical value, usually 0.05) when you iterate the experiments.

 

 

In the following demonstration, click the "Generate Numbers" button to run 100 trials. Clicking again will run another 100 trials. Observe what happens to the histograms as well as the corresponding p-values as the number of trials increases.

 

     

Numbers Generated:

Linear Congruence

Mersenne Twister

 

More MathApps

MathApps/ProbabilityAndStatistics


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam