This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Applets and the fly likes 10 shuffling question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "10 shuffling question" Watch "10 shuffling question" New topic
Author

10 shuffling question

pt wee
Greenhorn

Joined: Jan 01, 2004
Posts: 1
I am new to java, can anyone help me out?
I use random method, sometime same question appear on the applet.
Try using shuffling method but don't know how to do.

(Marilyn added code tags)
[ January 01, 2004: Message edited by: Marilyn de Queiroz ]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
If your problem boils down to permuting a list of strings then I suggest that you take a look at java.util.Collections. There is a shuffle method that does just that. You will also find java.util.Arrays useful to get yourself a List to shuffle.
[ January 02, 2004: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Originally posted by pt wee:
I use random method, sometime same question appear on the applet.
Try using shuffling method but don't know how to do.


Random will be random, sometimes the same question will appear more than once. You may need to "delete" those questions after they are "used" to prevent them from reappearing, or flag them as "used".


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
Don't get me started about those stupid light bulbs.
 
subject: 10 shuffling question
 
Similar Threads
Line spacing
retrieving and storing password from and to hashtable
missing components
Scrollbars
Problem with java layout and panels and containers