• Support PF! Buy your school textbooks, materials and every day products Here!

Generating a Random Number from an array for a blackjack simulator-Matlab

  • Thread starter Matt12
  • Start date
  • #1
2
0
Generating a Random Number from an array for a blackjack simulator--Matlab

I have a homework problem where I have to generate a single hand of blackjack to a player and allow the player to hit or hold. I'm ahving trouble generating the random card.

My attempt:

x = [1,2,3,4,5,6,7,8,9,10,10,10,10,11]; %the possible random numbers
CardValue = randi(x,1) %this is the problem, I want to draw a random card from the array



Thanks for any help!
 

Answers and Replies

  • #2
2
0


Also, this is my first post so if I'm in the wrong category or need to tell more, let me know!
 

Related Threads on Generating a Random Number from an array for a blackjack simulator-Matlab

  • Last Post
Replies
3
Views
6K
Replies
2
Views
920
Replies
1
Views
3K
Replies
10
Views
389
  • Last Post
Replies
1
Views
2K
Replies
0
Views
4K
Replies
3
Views
8K
Replies
4
Views
2K
  • Last Post
Replies
6
Views
4K
Replies
0
Views
1K
Top