Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

Your assignment is to use a random number generator to explore the game of roulette. A Eurpean roulette wheel has the following numbers:

Single zero wheel: 0-32-15-19-4-21-2-25-17-34-6-27-13-36-11-30-8-23-10-5-24-16-33-1-20-14-31-9-22-18-29-7-28-12-35-3-26

Despite the true mathematics of the matter, "0" is considered neither "odd" nor "even" when someone bets on the ball landing in an odd or even slot. (This is another way in which the house always wins in gambling.)

Many movies and stories have people making outlandish amounts of money by placing a bet on a single number, winning, and then leaving the winnings on that same number and, miraculously, winning again. Let's assume that each of the 37 numbers is equally likely to come up on any spin of the wheel. How unlikely is that any number comes up twice in a row?  And how unlikely is it for the fabled, lucky bettor to win twice in a row by betting the same number? (Be careful... these are two different answers!)

It is relatively straightforward to answer both of these questions using logic and statistics. However, you are to do it using simulations. (Such simulations are called "Monte Carlo simulations." Really!) Use your random number generator as if it were a roulette wheel. Throw a random integer between 0 and 36 inclusive. Each random number generated will represent one spin of the wheel, with the small ball landing in the slot with that number.  Answer the following questions empirically using the results of your simulation:

A. On average, how often does a number come up two times in a row? On average, how often does a number come up three times in a row?

B. If you pick a PARTICULAR number, how long does it take for that number to come up twice in a row? Let's make the number 13, just for fun.

C. What is the longest run of evens in a row in your simulation? What is the longest run of odds in a row?  (Remember that 0 is classified as neither odd nor even.)

You must do at least the following simulations. You may do more, but not less:

1. Do 10,000 spins of the wheel and answer the questions above.

2. Do 1,000,000 spins, and answer the questions above.

3. Do 100,000,000 spins, and answer the questions above.

4. Do 10,000,000,000 spins and answer the questions above. (It may take a long time to run this.)

Be careful to use qword instead of int variables for the appropriate declarations since some of these numbers will be way over 32,767 (the limit of a Pascal int).

Also, while you are debugging your program, it is wise to print out to the screen frequently so you can see what's going on (and perhaps what's going wrong!). But once you start running programs that do LOTS of calculations, then do input and output sparingly; input and output require FAR more time than other calculations, and you want simulations doing millions of trials to go quickly, not slowly.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91377880
  • Price:- $30

Guranteed 24 Hours Delivery, In Price:- $30

Have any Question?


Related Questions in Programming Language

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

  • 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