Evaluate quality of the random number generator in python

Assignment Help Python Programming
Reference no: EM13969025

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.

 

Reference no: EM13969025

Questions Cloud

Describe why this law or regulation causes these challenges : Laws and regulations are put in place to serve a purpose and to protect the entities and organizations that can be affected by them. Which law or regulation appears to cause significant challenges for international management? Describe why this law o..
Describe how the organization was managed in the past : Describe how the organization (Kaiser Permanente) was managed in the past. Compare the difference between management approaches in the past to those the organization currently uses. Ensure you identify relevant management theory both for past practic..
Culture of organization has impact on staffing decisions : The culture of an organization has a major impact on staffing decisions. Many organizations consider the company's talent philosophy-how the company views its employees-as an influence on staffing strategies. What are the decisions that influence a c..
Force of attraction between mars and the satellite : 1) What is the force of attraction between Mars and the satellite? 2) What speed should the satellite have to be in a perfectly circular orbit? 3) How much time does it take the satellite to complete one revolution?
Evaluate quality of the random number generator in python : 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.
Develop work for different types of crises : When there is a crisis within your organization employees are going to need to be trained on how to communicate with the media. What media and multimedia tools might best help you develop training content and material for employees and managers of an..
Problem regarding the beat frequency : The speed of sound is 343 m/s and the merry go round revolves once every 20s. What is the beat frequency that is detected by the listener when the speakers are both pointing at him from equal distances?
Explain the concept of future value : Explain the concept of Future Value (FV) in your own words. Why is FV an important topic in money management? Why would you want to take $1000 today instead of waiting for a year
What would their total recruiting cost be : The Digby's workforce complement will grow by 10% (rounded to the nearest person) next year. Ignoring downsizing from automating, what would their total recruiting cost be? Assume Digby spends the same amount extra above the $1,000 recruiting base as..

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd