# RandomNumberGeneratorUniform

## Uniform Random Number Generator Validation

The Uniform Random Number Generator of ns-3 advertizes itself as able to generate a sequence of random numbers that is uniformly distributed across a range. The ns-3 class that implements this behavior is **UniformVariable**. By default it produces a sequence of double values in the range [0, 1).

Our goal is to validate that the random number generator does, in fact, do this.

### Methodology

We apply a chi square test of goodness of fit to evaluate the function. We create a histogram with 50 bins uniformly distributed across the range [0, 1) and generate 1 000 000 random numbers which we assign to appropriate bins in the histogram.

Since the expected value is provided for us (we do not calculate it from the data) the degrees of freedom in the chi square test is 50. Using this value, we calculate a maximum chi squared statistic corresponding to the 0.05 significance level as 67.5048. Ten runs of the test for goodness of fit results in an average chi square statistic of 46.3228 which is less than.

Craigdo 20:47, 17 April 2009 (UTC)