Jump to content

Recommended Posts

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.

 

 

Link to comment
https://forums.phpfreaks.com/topic/290246-pass-randomized-array-to-other-users/
Share on other sites

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.