# Random seed per student

When working with random numbers, you may want every student always to have the same seed for the random number 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`

.

## Example

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 $P$ , and two vectors $u$, $v$ , and we will ask them some questions:

Does $P$ belong to a given line?

Is $u$ parallel to a given vector?

Give the equation of the plane with vectors $u$ and $v$ and passing through $P$

Give a linearly independent vector concerning $u$ and $v$

Give a vector orthogonal to $u$ and $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 $u$ and $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 $u$ and $v$ are the same in both questions. Then, for instance, a student can answer the normal vector of the plane as the orthogonal vector.