Check out the LimeSurvey source code on GitHub!

randomly draw several numbers out of a sample

More
3 years 8 months ago #96502 by debirah
Dear Limesurvey Community

I have a question, is it possible to draw six random numbers out of total 12 numbers without repetition? So that each selected number appears only once?

Thank you very much for your help.

Please Log in to join the conversation.

More
3 years 8 months ago #96518 by tpartner
Could you please give us some context? What are you trying to do?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
3 years 8 months ago #96520 by debirah
I have 12 possible answers, however for each participant I only want to display 6 of the 12 possible answers. These 6 have to be drawn randomly. So I thought that each answer will be coded as a number and limesurvey then randomly draws for each participant an array of 6 numbers out of the 12 possible numbers.

So as an example:
Participant 1: 12,1,5,4,8,6
Participant 2: 10,6,7,3,11,4

etc.

I hope this helps to understand what I want to do...

Please Log in to join the conversation.

More
3 years 8 months ago #96526 by tpartner
Probably the easiest way to handle that would be to set the answers to display randomly and then use JavaScript to hide all but the first 6 answers.

I suspect you would want to record which were shown so you may want a following hidden short-text for that.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form