Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Python Expert

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.

 

Python, Programming

  • Category:- Python
  • Reference No.:- M91643970

Have any Question?


Related Questions in Python

Questionwhat is a python development frameworkgive 3

Question What is a python development framework? Give 3 examples python development framework used today. and explain which development framework is used in which industry.

Question write a python program with a graphical user

Question: Write a python program with a graphical user interface that will allow a user to create a custom pizza which they wish to order. At minimum, the user should be able to choose the size of the pizza, the type of ...

Assignment1 utilising python 3 build the following

Assignment 1. Utilising Python 3 Build the following regression models: - Decision Tree - Gradient Boosted Tree - Linear regression 2. Select a dataset (other than the example dataset given in section 3) and apply the De ...

The second task in this assignment is to create a python

The second task in this assignment is to create a Python program called pancakes.py that will determine the final order of a stack of pancakes after a series of flips.(PYTHON 3) Problem Task In this problem, your input w ...

In this programming assignment you will write a client

In this programming assignment, you will write a client pingprogram in Python. Your client will send a simple ping message to a server, receive a correspondingpong message back from the server, and determine the delay be ...

Lab assignment -background - we have discussed in detail

Lab Assignment - Background - We have discussed, in detail, the function of Stacks and Queues and how they are specifically implemented in Python. To get a better understanding of the utility of these data structures, we ...

A software company sells a package that retails for 99

A software company sells a package that retails for $99. Quantity discounts are given according to the following table: Quantity Discount 10 - 19 20% 20 - 49 30% 50 - 99 40% 100 or more 50% Write a program using python t ...

Show times in tmus and seconds1 an associate grasps an oven

Show times in TMUs and seconds. 1. An associate grasps an oven door within reach and pulls it open 18 inches with the left hand (he does not relinquish control of the door). With a pan in the right hand, he carefully pos ...

Simple python traffic lightswrite a program that simulates

Simple Python (Traffic lights) Write a program that simulates a traffic light. The program lets the user select one of three lights: red, yellow, or green. When a radio button is selected, the light is turned on, and onl ...

Sieve of eratosthenes in pythonthe goal is to find all the

Sieve of Eratosthenes (in Python) The goal is to find all the prime numbers less than or equal to some natural number maxn. We have a list that tells us if any of the numbers 0..maxn are "marked". It can be an array of b ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As