Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I get Random sort in Java array? (any element in an array)

Status
Not open for further replies.

diljava

Programmer
Joined
Jul 19, 2003
Messages
2
Location
IN
This is required to develop an online exam. After reading from the databse
to an array, each time the array should be sorted in random order.
 
It sounds like you've a shuffling class/method in mind rather than sorting class/method. Because, sort will order the arraylist the same way everytime.


Libaax
Hakuna Matata....;)
 
hi
I'm not a java progrommer, but I happen to post another question on this forum and saw your post.

there is a similar problem in the javascript forum which someone solved very efficiently. It uses a classic loop and the built-in pseudorandom function in javascript. maybe ther is an equivalent class in java you could use the same way?

see thread216-645064

hope it helps.

sundemon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top