jandrews3 Posted August 3, 2014 Share Posted August 3, 2014 I want the quiz questions a teacher loads to be randomized so that each time the teacher gives it (different class, different day, whatever …) the order of questions will be randomized. I'm loading the data into an array and then shuffling it. Problem solved. BUT … students on their smart devices need to load the same quiz with the same question order. I can solve this by: - teacher stores question and answer data and order temporarily in a dB table - students load that information - problem solved But I was hoping to do this without using a table. Is there a way to pass a randomized array from the teacher to the students without going through a dB table? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/290246-pass-randomized-array-to-other-users/ Share on other sites More sharing options...
davidannis Posted August 3, 2014 Share Posted August 3, 2014 I don't think so. HTTP is stateless and you need to store the order someplace. The only other solution I can think of is to use an old pseudo random number generator that does not automatically seed and creates the same sequence if given the same seed and then have the teacher distribute the seed to the students. Hardly seems worth it to me, easier just to store the sequence. Also, storing it allows the teacher to have a copy of the questions in the correct order when reviewing it with students, etc. even if she reused the test. Quote Link to comment https://forums.phpfreaks.com/topic/290246-pass-randomized-array-to-other-users/#findComment-1486736 Share on other sites More sharing options...
sasa Posted August 4, 2014 Share Posted August 4, 2014 in MySL you can use 'ORDER BY RAND(N)' where N is seed for generate random numbers. If you use same N order is been same Quote Link to comment https://forums.phpfreaks.com/topic/290246-pass-randomized-array-to-other-users/#findComment-1486791 Share on other sites More sharing options...
CroNiX Posted August 4, 2014 Share Posted August 4, 2014 It would be best to use a db for this, but you can always save a questionnaire to a file and serve that to the users. You could even store a serialized array or whatever you want to do, but personally I'd probably save it as a PDF and serve that to the students as it's more of a universal format. Quote Link to comment https://forums.phpfreaks.com/topic/290246-pass-randomized-array-to-other-users/#findComment-1486795 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.