Randomizing Database Questions

Reply

Join Date: Nov 2004
Posts: 2
Reputation: Luminus is an unknown quantity at this point 
Solved Threads: 0
Luminus Luminus is offline Offline
Newbie Poster

Randomizing Database Questions

 
0
  #1
Dec 7th, 2004
Please.
I'm writing a Test Engine Software and I have a big issue. I have a large question database about 1000 questions and I need to load 50 random questions for each test instance. i.e Each time a user runs the test, 50 DISTINCT questions will be loaded.

They should not be the same every time and questions that have already been loaded and or answered should not be displayed again.

Right now, I have extracted all the questions into a ResultSet, is there a way I can shuffle the questions and select the top 50 into a new ResultSet and use the new ResultSet to administer the test. If it's possible, it'll make my job easier. If not, I'd really appreciate any help I can get.

Thanx

Luminus
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Randomizing Database Questions

 
0
  #2
Dec 8th, 2004
no, that's not possible.
What I'd do is store the questions with a unique number as a key, then create 50 random numbers and pull the questions with those numbers out of the database.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 2
Reputation: Luminus is an unknown quantity at this point 
Solved Threads: 0
Luminus Luminus is offline Offline
Newbie Poster

Re: Randomizing Database Questions

 
0
  #3
Dec 8th, 2004
Originally Posted by jwenting
no, that's not possible.
What I'd do is store the questions with a unique number as a key, then create 50 random numbers and pull the questions with those numbers out of the database.
Could you please gimme some sample code so I know how to go about it and any other suggestions will be highly appreciated.

Thanx
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC