• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Randomize a set of words

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. Not sure if this is the right place to post this. We are trying to create a table that has a ton of four letter words in it(minus the nasty ones ). Right now we have the list of words in an Excel spreadsheet in alphabetical order. We want to scramble these so when we use them to be assigned as order codes, they don't get assigned alphabetically. My question is, how do I do this? Can anyone supply me with some java code to get this done, or at least give me a couple of hints where to look?
Thanks in advance!!
 
Michael Matola
whippersnapper
Ranch Hand
Posts: 1821
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at Collections.shuffle() to see it can help you out.
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try something like this

This will return the String[] in a completely random order.
[ April 08, 2002: Message edited by: Carl Trusiak ]
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic