I have a random number generator that generate integers within [0, r)
.
I want to write a piece of code to test whether the numbers from it are truly uniformly distributed using chi-square test.
I select r
to be very big like 1,000,000
, and I generate random integers 10,000,000
times. Then I get the X^2
.
The next thing I need to do is to check the chi-square value against a degree of freedom table. But I am not allowed to have one, nor using some online distribution calculator.
What should I do?
Someone told me that I can just calculate an interval: r^2 - 2*r*(sqrt r)
and r^2+2*r*(sqrt r)
, then to see whether the value fall in that interval or not. But he doesn't know the reason either.
Is the way above correct?