I am working on a survey application. I have a sql server database holding upto 3000 survey questions.
I call database for a set of 10 questions. I have to make sure that none of the of the questions are repeated for the longest time possible.
What is the best possible approach I can take here? Write a custom randomization algorithm or SQL server provides some functionality.
I am working on a survey application. I have a sql server database holding
Share
gives you all the question ids in random order. store the list, and work your way down.
There isn’t a way to ensure the longest time between repeats without storing the order. You could make it another column on the same table…
EDIT: a variation on Mr Jacques’ idea:
how about a column named random? Shuffle the order like so:
then get each new question like this:
Then you could shuffle the order at intervals, every night maybe.