1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Nov 8, 2011 #1
    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!
     
  2. jcsd
  3. Nov 8, 2011 #2
    Re: Generating a Random Number from an array for a blackjack simulator--Matlab

    Also, this is my first post so if I'm in the wrong category or need to tell more, let me know!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Generating a Random Number from an array for a blackjack simulator-Matlab
  1. MATLAB - blackjack (Replies: 3)

Loading...