How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Scott Your Own Question
Scott, MIT Graduate
Category: Homework
Satisfied Customers: 3040
Experience:  MIT Graduate (Math, Programming, Science, and Music)
Type Your Homework Question Here...
Scott is online now
A new question is answered every 9 seconds

Your assignment is to use a random number generator to explore

Customer Question

Your assignment is to use a random number generator to explore the game of roulette. A Eurpean roulette wheel has the following numbers: using pascal
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.
Submitted: 2 years ago.
Category: Homework
Expert:  Mr. Gregory White replied 2 years ago.
Hello, my name is Greg.
I see this might be time sensitive.
Do you still need this answered?