I have a database wherein i get my questions , correct answers/options from… I want my application to automatically generate random rowIds so that the questions could be shuffled.. Of course, the question that’s already shown should not display again. I want to get 10 questions then finish();..
Share
Using a random rowId is the wrong approach. What if the database is modified and the ID becomes invalid? You’d have to check every ID and regenerate when an invalid ID comes up.
Instead, you should use a LIMIT clause in your SELECT statement with a random number less than the number of rows in the table.