Understanding Kolmogorov-Smirnov Test Results for Random Number Generators

In summary, the speaker is seeking clarification on the results of a Kolmogorov test they conducted using a C++ program that generates random numbers following a Landau distribution. They are unsure about the interpretation of the results and are questioning whether there may be an error in their code. However, without more information and details, it is difficult to accurately assess the situation and determine a solution.
  • #1
Federica
12
1
Hi all,

I have some doubts regarding the Kolmogorov test: I made a simple c++ program generating two samples of random numbers following a Landau distribution (I used the "hit and miss" method). I made the Kolmogorov test, in order to check the randomness of the generator, but I'm having some problems with the interpretation of the results (I attach the histogram here).

It seems I'm having a probability which is (more or less) uniformly distributed from 0 to 1. Is that correct? Or there's something wrong with my code? I expected to get a probability really close to 1, since the two sets come from the same distribution.
 

Attachments

  • kolmogorov.png
    kolmogorov.png
    4.9 KB · Views: 186
Physics news on Phys.org
  • #2
This sounds a lot like "Tell me if I have a bug in my code that I won't share with you based on a plot with ambiguous labels and not enough information to reproduce."

I think you might want to add some more details. A lot of them.
 

1. What is the Kolmogorov-Smirnov test and how does it relate to random number generators?

The Kolmogorov-Smirnov test is a statistical test used to determine whether a set of data follows a specific distribution. It is often used to test the randomness of numbers generated by a random number generator. It compares the cumulative distribution function of the observed data to the theoretical distribution and calculates a p-value to determine the level of agreement between the two.

2. How do I interpret the results of a Kolmogorov-Smirnov test for a random number generator?

The results of a Kolmogorov-Smirnov test will include a p-value and a test statistic. The p-value represents the probability of obtaining the observed results if the data truly follows the expected distribution. A higher p-value indicates a better fit between the observed data and the expected distribution. The test statistic represents the maximum difference between the observed and expected cumulative distribution functions. A lower test statistic also indicates a better fit between the data and the expected distribution.

3. What is a good p-value for a Kolmogorov-Smirnov test for random number generators?

There is no definitive answer to what constitutes a good p-value for a Kolmogorov-Smirnov test. It depends on the specific application and the level of confidence required. In general, a p-value of 0.05 or lower is considered significant and indicates that the data does not follow the expected distribution. However, for some applications, a higher p-value may be acceptable.

4. Can the Kolmogorov-Smirnov test be used to compare different random number generators?

Yes, the Kolmogorov-Smirnov test can be used to compare the randomness of different random number generators. By running the test on the output of each generator and comparing the p-values and test statistics, it is possible to determine which generator produces numbers that are closer to a truly random distribution.

5. Are there any limitations to using the Kolmogorov-Smirnov test for random number generators?

Yes, there are some limitations to using the Kolmogorov-Smirnov test for random number generators. It assumes that the data is continuous and that the expected distribution is fully specified. It may also be affected by the sample size and the number of bins used to create the cumulative distribution function. Additionally, it is not suitable for testing the randomness of non-numerical data or data that is not normally distributed.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
11
Views
393
  • Set Theory, Logic, Probability, Statistics
Replies
30
Views
2K
  • Programming and Computer Science
Replies
1
Views
591
Replies
12
Views
687
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
371
  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
909
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
193
  • Calculus and Beyond Homework Help
Replies
9
Views
2K
Back
Top