Random Number Generator Analysis

advertisement
Problem # 5
Code Wars II
Danger Level: Green
“Random Number Generator Analysis”
Point Value: 3
Problem Statement
Verify the randomness of the random number generator.
For each ‘n’ from the input file, analyze the effectiveness of the random number
generator by creating 20,000*(n+1) random numbers and printing out the count for each
number. There should not be an obvious difference in randomness. Also verify that the
sum of the counts is equal to 20,000*(n+1).
Program Input
From the input file ‘PROB05.IN’, each line will contain a number ‘n’ to be
used for the random number generator analysis. For each ‘n’, create random
numbers from 0-n inclusive.
4
7
14
Program Output
Output the counts for all numbers that are selected by the random number generator to
the output file ‘PROB05.OUT’. The sample output below represents n=4 only.
Random number range is 0-4 (n=4)
0 = 20031
1 = 19982
2 = 20028
3 = 19973
4 = 19986
Total = 100000
Download