Random seed per student


Functionality is available for Moodle only in WirisQuizzes versions later than 3.78.1. Feel free to contact us via support@wiris.com if you experience related problems in other environments.

When working with random numbers, you may want every student always to have the same seed for the random numbers generation. This way, a question will always have the same random values, even if the quiz is re-started several times; or the student will have the same data in different examinations over the course.

To do so, you need to call the parameter user_id, which identifies every student by an ID; and fix the random seed.


It will always give the same number a.


This option is advantageous when, for instance, we want to ask different types of questions (like in Cloze question type), but we have to use a grading function.

As an example, we will give the students a point PLaTeX P , and two vectors uLaTeX u, vLaTeX v , and we will ask them some questions:

  • Does PLaTeX P belong to a given line?

  • Is uLaTeX u parallel to a given vector?

  • Give the equation of the plane with vectors uLaTeX u and vLaTeX v and passing through PLaTeX P

  • Give a linearly independent vector concerning uLaTeX u and vLaTeX v

  • Give a vector orthogonal to uLaTeX u and vLaTeX v

We can use a multichoice question type; for the third, we can use a short answer question type with the Equivalent equations validation property selected. We should use a grading function for the last two questions because there are infinite solutions. Hence, we will create a Cloze question type for the first three questions and a short answer question type with a grading function for the last two. We will fix the random seed for each student so that the vectors uLaTeX u and vLaTeX v are the same in the two questions.

For the first question, select Equivalent equations on the Validation tab and write the following algorithm:


The statement would look like:


For the second question, the algorithm will be


A quiz with both questions will be shown as


Note that the vectors uLaTeX u and vLaTeX v are the same in both questions. Then, for instance, a student can answer the normal vector of the plane as the orthogonal vector.