Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Shuffleing and array

 
Sally Curtis
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i am writing a black jack program and was wondering how i would shuffle an array that consisted of 52 cards( characters)
 
chi Lin
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Collections provides a static shuffle(List lst) method.
 
Sally Curtis
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how come i keep getting an error ackage Collections does not exist
Collections.shuffle(Array.asList(cards);?
^
 
chi Lin
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need Collections.shuffle(Arrays.asList(cards);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic