I have a program which generates random numbers. How can I test if the random number generator is generating actual random numbers?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
If numbers are being computer generated, they won't be truly random, they will be pseudo-random numbers.
I would head over to math.stackexchange.com to get a good understanding of the problem you are trying to test.
Some good, related questions are:
You should also look in to ways you can automate the testing. To truly test this you will need to test a very large sample size, and then visualise the distribution of results.
Try this document - Chapter 10 of Beautiful Testing
For a simple example, have a look at this example blog post from Alan Page
See for example http://en.wikipedia.org/wiki/Statistical_randomness for a list of possible tests to check randomness of the generator. http://en.wikipedia.org/wiki/Random_number_generation gives pointers to other things you might be interested in your generator.