This isn’t so much a coding question as a “how would I code” question – I don’t know if SO is the right place, so sorry if that’s the case.
Imagine an online test that has 75 questions. Each person taking the test will see five “random” questions (but, as you’ll see, it’s not random at all).
I need to know how to order these questions to give them an equal chance of being seen (so, after 750 people have taken the test, all the questions have been seen ten times).
Would it be best to write a script that looks to see which question has the lowest number of hits, and then show that one? Or to set up a preset list of questions for each user to see?
The script will be written in PHP with a MySQL backend, not that I think that’s important.
If you really want all 75 questions be uniformly displayed I’d do something like this:
in this way you get random questions for each user and not the same question twice until all questions have been displayed.
You may also need to keep track of which questions each user has already gotten. Log this in another table and if there is a hit then skip that one and get and remove the next instead.