View Issue Details

This issue affects 2 person(s).
 10
IDProjectCategoryView StatusLast Update
18440Bug reportsConditionspublic2026-10-23 15:20
Reporterlile2924 Assigned Toc_schmitz  
PriorityhighSeverityminor 
Status confirmedResolutionopen 
Product Version5.4.x 
Summary18440: Semantic differential array subquestions gets shuffled only once per participant
Description

Hello,

I have a semantic differential array type question with 33 subquestions. I have a survey structure as follows:

Question Group1 (rand)
a related question to group 1
array question with randomized display of subquestions

Question Group 2 (rand)
a related question to group 2
array question with randomized display of subquestions

Question Group 3 (rand)
..
Question Group 6 (rand)

When I run the survey in preview mode it works as I want it: The question groups are viewed in randomized order and array subquestions are also in randomized order in each question group. When I activate the survey the array question with randomized display of subquestions gets only shuffled once and the same shuffled order repeats through all question groups. How can I solve this problem?

Steps To Reproduce

I have a mock survey uploaded

TagsNo tags attached.
Attached Files
Bug heat10
Complete LimeSurvey version number (& build)Version 5.4.3+220926
I will donate to the project if issue is resolvedNo
Browser
Database type & version?
Server OS (if known)
Webserver software & version (if known)
PHP Version?
Git branch / Pull Request URL

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2022-11-03 18:55

developer   ~72541

We use same seed for all order of questions …
We don't have this issue already reported ?
https://github.com/LimeSurvey/LimeSurvey/blob/42cfc2d9c6f7eb0302a8bddefa24d2203cb84339/application/models/Question.php#L796
https://github.com/LimeSurvey/LimeSurvey/blob/42cfc2d9c6f7eb0302a8bddefa24d2203cb84339/application/libraries/MersenneTwister.php#L45

DenisChenu

DenisChenu

2023-03-21 09:04

developer   ~74213

https://forums.limesurvey.org/index.php/forum/design-issues/134562-random-order-is-the-same-for-all-questions#241594

c_schmitz

c_schmitz

2026-10-22 22:00

administrator   ~86705

Last edited: 2026-10-23 00:05

Here is an idea how to fix that: Give every question its own fixed random number that is kept when the survey is exported and imported.
That field could be part of the question table and named 'random_salt'. It is immutable.
Combined with the response's seed value, each question gets its own order. That order stays the same for the participant even if questions are renamed or reordered, or the survey is re-imported from an archive.

The cause: All randomized questions in a response start from the same random value, so questions with the same number of subquestions always end up in the same order. In preview a new value is picked every time, which is why it looks fine there.

DenisChenu

DenisChenu

2026-10-23 00:31

developer   ~86711

Last edited: 2026-10-23 00:31

Here is an idea how to fix that: Give every question its own fixed random number that is kept when the survey is exported and imported.

I'm sure I add another idea somewhere

It's about a new Question atribute : "Salt for randomization" :

  • Empty : qid+seed (or near something like this)
  • Set (by expression manager) use it : can be {QCODE.qid}+seed

Then : by default all questions didn't have same order, but you can set the same order for some specific question.

PS : https://bugs.limesurvey.org/view.php?id=18675 seems deleted ?

DenisChenu

DenisChenu

2026-10-23 08:09

developer   ~86712

Forum discussion related : https://forums.limesurvey.org/forum/design-issues/157327-randomising-answers-in-consecutive-multiple-choice-questions?utm_source=chatgpt.com

If you want different randomization, use different sub-question codes.

Having such a solution can really be great !
Adding a "salt" to the seed came from Question attributes can certainly be a good solution.

c_schmitz

c_schmitz

2026-10-23 11:56

administrator   ~86713

#18675 is there.

THe QID can change on restoring from an archive and this makes it for usage as salt worthless.
My proposal is better because the stored salt per question will be immutable.
If a user wants to change it, fine with me - show a stern warning, though.

DenisChenu

DenisChenu

2026-10-23 15:20

developer   ~86718

THe QID can change on restoring from an archive and this makes it for usage as salt worthless.

Right, but unsure of the real issue here :)

My proposal is better because the stored salt per question will be immutable.

Then create (and show it in settings) when a question is created?

Issue History

Date Modified Username Field Change
2022-11-01 14:43 lile2924 New Issue
2022-11-01 14:43 lile2924 File Added: limesurvey_survey_983815_mock.lss
2022-11-02 11:01 ollehar Priority none => high
2022-11-03 13:55 gabrieljenik Status new => acknowledged
2022-11-03 18:55 DenisChenu Note Added: 72541
2022-11-03 18:55 DenisChenu Bug heat 0 => 2
2023-03-21 09:04 DenisChenu Note Added: 74213
2023-03-21 15:29 guest Bug heat 2 => 8
2026-10-22 22:00 c_schmitz Note Added: 86705
2026-10-22 22:00 c_schmitz Bug heat 8 => 10
2026-10-22 22:01 c_schmitz Note Edited: 86705
2026-10-22 22:02 c_schmitz Assigned To => c_schmitz
2026-10-22 22:02 c_schmitz Status acknowledged => confirmed
2026-10-23 00:05 c_schmitz Note Edited: 86705
2026-10-23 00:31 DenisChenu Note Added: 86711
2026-10-23 00:31 DenisChenu Note Edited: 86711
2026-10-23 08:09 DenisChenu Note Added: 86712
2026-10-23 11:56 c_schmitz Note Added: 86713
2026-10-23 15:20 DenisChenu Note Added: 86718