Hi everyone. I am new to LimeSurvey and do not have much coding experience.
I am trying to modify the following code used on another forum post to create 10 (min 1 max 10) randomly generated numbers that do not repeat. This is the original blog post:
forums.limesurvey.org/forum/can-i-do-thi...ame-randnumber-twice
. I was able to edit the code so that more than 2 random numbers are generated, but how can I edit the if statement so that none of the additional numbers repeat?
I misunderstood the purpose of the if statement, so I had been focusing on it in order to solve the issue with the repeating numbers. But after you explained it, I found the error elsewhere in my code. Thank you!!
Thank you for your help last month. I have a quick followup question. I have used this code several times in my survey and there is one section that I would like to change to allow the numbers to repeat. Is there a modification I can do to the original code to allow the numbers to repeat?
I have been able to get all of the randomization to work. However, I do not want participants to see the page which generates all of the random numbers. I tried to hide each question using the "Always hide this question" in the "Display" section, but I think this stops the random numbers from generating because the text that should appear later in the survey does not show anymore. What can I do so that the random numbers are generated but not shown to participants?
I tried this and it hides the generator but leaves blank pages which the respondent must click through. Is there a way to do this where it does not show these pages to the respondent at all?
No, you should put these hidden questions on other pages together with other questions. Using Group-by-Group and use the Groups as if they were pages. If you go question per question, then there will be always empty pages.
We generally recommend to use the group by group mode, because it gives you the chance to be more flexible and put more than one question on a 'page' or just one question as well. It is more work because you probably need more groups, but there is no other way in LS to create "pages" with more than one question than going group by group. And even if you don't want to show these questions you still need to place them.
If you use the "always hide" option the gui you don't need that, but then you can't use these hidden questions for Javascript, etc.
Help us to help you!
Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
Hi again! I have another follow-up question so I thought I would write it here for continuity. After initial feedback from the survey, I made some changes to the number of treatments, format, etc. and now the non-repeating random number generator does not load when the page loads. However, when I make the question mandatory and then try to complete the survey, I get an error message that I did not fill out a mandatory question and then the page loads the random numbers and I can continue. Do you know what could be causing this issue?