Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Random Numbers 3.20 Many games require the player to roll two dice. The number on each die can vary from 1 to 6. (a) Use

image text in transcribed
image text in transcribed
Random Numbers 3.20 Many games require the player to roll two dice. The number on each die can vary from 1 to 6. (a) Use the rand function in combination with a rounding function to cre- ate a simulation of one roll of one die. (b) Use your results from part (a) to create a simulation of the value rolled with a second die. (c) Add your two results to create a value representing the total rolled dur ing each turn. (d) Use your program to determine the values rolled in a favorite board game, or use the game shown in Figure P3.20. Co n ra dociering a container to ship sensitive medical materials Step (a) Many games require the player to roll two dice. The number on each die can vary from 1 to 6. The following is the MATLAB program we can create a simulation of one roll of one die by using the rand function with a rounding function. r=0; rl=round(rand(1,1)*5+1) Output: Here the output is a single value. We will get the values from 1 to 6 as we execute the above code many times. Step 2 DO (b) The following is the MATLAB program that uses the results from the part(a) to create a simulation of the value rolled with a second die. r=5; r2=round(rand(1,1)*5+1) Output: r2 = Here the output is a single value. We will get the values from 1 to 6 as we execute the above code many times. Random Numbers 3.20 Many games require the player to roll two dice. The number on each die can vary from 1 to 6. (a) Use the rand function in combination with a rounding function to cre- ate a simulation of one roll of one die. (b) Use your results from part (a) to create a simulation of the value rolled with a second die. (c) Add your two results to create a value representing the total rolled dur ing each turn. (d) Use your program to determine the values rolled in a favorite board game, or use the game shown in Figure P3.20. Co n ra dociering a container to ship sensitive medical materials Step (a) Many games require the player to roll two dice. The number on each die can vary from 1 to 6. The following is the MATLAB program we can create a simulation of one roll of one die by using the rand function with a rounding function. r=0; rl=round(rand(1,1)*5+1) Output: Here the output is a single value. We will get the values from 1 to 6 as we execute the above code many times. Step 2 DO (b) The following is the MATLAB program that uses the results from the part(a) to create a simulation of the value rolled with a second die. r=5; r2=round(rand(1,1)*5+1) Output: r2 = Here the output is a single value. We will get the values from 1 to 6 as we execute the above code many times

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Google Analytics 4 The Data Driven Marketing Revolution

Authors: Galen Poll

2024th Edition

B0CRK92F5F, 979-8873956234

More Books

Students also viewed these Databases questions

Question

List the advantages and disadvantages of the pay programs. page 505

Answered: 1 week ago