Question: Use the randperm function to shuffle the deck. You want it to produce a vector with the numbers 1 - 5 2 , with no

Use the randperm function to "shuffle" the deck. You want it to produce a vector with the numbers 1-52, with no repeats, in random order. Use the help function to see how to use randperm.
Have an outer for loop over players and an inner for loop over cards. Start with the first element of the deck vector and each time you need a new card, advance to the next element.
Use the rem function to determine the rank of each card. The remainder after dividing a card number by 13 will be in the range 0-12. Add one to get the range 1-13. Rank 1 is an Ace, ranks 11-13 are Jack, Queen, King, respectively, and the rest are the numbered ranks.
Use division by 13 and the ceil rounding function to determine the suit of each drawn card (1=Clubs, 2=Diamonds, 3=Hearts, 4=Spades).
Once you know the suit and rank of the current card, print it to the command window (one card per line) as in the example above.
Turn in your m-file containing your code. The usual indenting and commenting rules apply.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!