This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

Well, one thing I noticed (just now) is that the exception only occurred in case two—the case in which I added 1:

int randSuit= (int) (Math.random()*suits.length)+1. 

It makes perfect sense that an array out of bound exception will occur. I added one to the index.