# randomly draw several numbers out of a sample

4 years 10 months ago #96502 by debirah
debirah created the topic: randomly draw several numbers out of a sample
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 or Create an account to join the conversation.

4 years 10 months ago #96518 by tpartner
tpartner replied the topic: randomly draw several numbers out of a sample
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 or Create an account to join the conversation.

4 years 10 months ago #96520 by debirah
debirah replied the topic: randomly draw several numbers out of a sample
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 or Create an account to join the conversation.

4 years 10 months ago #96526 by tpartner
tpartner replied the topic: randomly draw several numbers out of a sample
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 or Create an account to join the conversation.