mardi 15 septembre 2015

Testing C Random Number Generator

I am working on a project and I am stuck on how to complete a specific part.

The assignment is "Write a program to determine whether or not the C random number generator really generates uniformly random number. You will do this by creating an array of 20 integers and then generating 200,000 random numbers between 0 and 19 (inclusive). For each random number, n, that is generated, increment the nth element of the array by 1. If the C random number generator is uniform, then every element in the array should end up with roughly the same value. To find out if this is the case, you will need to print the array. You will also need to print out the minimum and maximum values of the array, along with the mean and standard deviation."

However, I need help with the for each random number, n, that is generated, increment the the nth element of the array by 1. I am not really sure what is being asked or how to go about it. I am not asking for the code to do it, but what should I use in order to complete it.

I am fairly new to C so apologies in advance if this is an obvious answer.




Aucun commentaire:

Enregistrer un commentaire