This program is going to evaluate the quality of the random


This program is going to evaluate the quality of the random number generator in Python by simulating dice rolls and looking at the distributions of the values. A random number generator must be initialized with a seed value. Then random values can be computed using a fancy calculation. We will use the random module. The seed() function without any arguments will use the system clock to seed the calculations. The random(a,b) function call will return an integer in the range from a to b. We will use a=1 and b=6 to return values for a six sided die. Adding two of these together simulates a dice roll. If these rolls were truly random, the odds of getting a particular value are: 2 and 12 - 1/36, 3 and 11 - 2/36, 4 and 10 - 3/36, 5 and 9 - 4/36, 6 and 8 - 5/36, and 7 - 6/36.

You are going to determine how close to these probabilities we can get for different sample sizes of dice rolls. For each sample size you should roll the dice a particular number of times and keep track of how often each value occurs in a list. You should create a list of lists that holds the counts for a sequence of sample sizes that includes 100, 1000, 10000, 100000, 1000000 and 10000000. For each list corresponding to a particular sample size, you should compute the percentage of the rolls corresponding to each dice value. You should then compute the difference between each of these values and the ideal percentages given above.

You then should print a table of these percentage difference values, where the rows correspond to the dice values and the columns correspond to the sample sizes. If the random number generator is working well, these differences should get smaller as the sample sizes grow. Print out a final assessment of the generator's quality as good or bad. A good rating is given if the difference values for each dice value do decrease as sample size grows, otherwise a bad rating is given if for any dice value the differences between two sample sizes do not get smaller.

Make sure that you properly comment your program. Submit the source file along with sample output of your program showing the table of data.

 

Request for Solution File

Ask an Expert for Answer!!
Python Programming: This program is going to evaluate the quality of the random
Reference No:- TGS01275456

Expected delivery within 24 Hours