Question Card/Deck Building Trouble

Brainstorm

New member
Joined
Nov 22, 2010
Messages
1
Programming Experience
Beginner
I'm writing a program in VB.net to play blackjack, I'm pretty new to coding and I'm having some trouble.

Basically the program is "done" but it doesn't work, when I try to test it it breaks at this point (arrow):

VB.NET:
Private Sub fillDeck()
    Dim cards As String = "K,Q,J,10,9,8,7,6,5,4,3,2,1,"
    Dim Suites As String = "C,S,H,D,"
 
    Dim i As Integer = 0
    Dim ran As Random = New Random()
 
 
    For i = 0 To 10
        ran.NextDouble()
    Next
 
    For i = 1 To 52
        Dim cardItem As Integer = Integer.Parse((ran.NextDouble() * ((cards.Length - 1) / 2)).ToString().Split(".")(0))
        Dim SuiteItem As Integer = Integer.Parse((ran.NextDouble() * ((Suites.Length - 1) / 2)).ToString().Split(".")(0))
 
      --> deck.Add(cards.Split(",")(cardItem) + Suites.Split(",")(SuiteItem))
    Next
End Sub
Basically it crashes and tells me the values out of range, can anyone halp!?
 
Back
Top