Generate an array of 10 random numbers between 0 and 1


Q1:
Write a Matlab code that determines the winner in a game of dice. Consider two players rolling a die. The player with a higher number scores a point. If they roll the same number, no one scores a point. Ask the players how many games (N) they would want to play (here we assume that both players agree on thesame number of games to be played and so it is enough to ask one input common for both). Display the
winner of each game and also the final winner at the end of N games along with the number of points scored. The outcomes could also be a tie. (Hint: Rolling of a die can be mimicked by using the randi function for each player. Remember that the outcome of a die is any number ranging from 1-6)
Q2: 
Generate an array of 10 random numbers between 0 and 1 using the rand function. Round-off the numbers in the array using the round function (The array should now have 0s and 1s). Display to the user in a fullsentence the number of 1s present in the array after rounding.

Solution Preview :

Prepared by a verified Expert
Applied Statistics: Generate an array of 10 random numbers between 0 and 1
Reference No:- TGS01155509

Now Priced at $20 (50% Discount)

Recommended (97%)

Rated (4.9/5)