Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Random number in anonymous survey

  • leviathan
  • leviathan's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 4 months ago #144584 by leviathan
Random number in anonymous survey was created by leviathan
I am setting up an anonymous survey. I want to give some prize to random respondent after filling the survey and need a random number generated from set of numbers (eg. 1000 - 2000). Problem is that one number should only generated once. Is there this kind addons available or similar achievement or do i have to made it by myself?

Plan:
Recipients answers questions anonymously
Random number is printed in the last page of survey with text "Please, come to us and check if you win some prize. Your lucky number is: xxxxxxxx".
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 4 months ago #144607 by tpartner
Replied by tpartner on topic Random number in anonymous survey
You'll have to code that yourself - there is no access to previous results from within a survey.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • leviathan
  • leviathan's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 4 months ago #144615 by leviathan
Replied by leviathan on topic Random number in anonymous survey
Actually i don't need any previous results. I need one unique number witch is related to answerer.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 4 months ago #144616 by tpartner
Replied by tpartner on topic Random number in anonymous survey
Yes, you do need previous results to find which random numbers have already been assigned.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 4 months ago #144617 by holch
Replied by holch on topic Random number in anonymous survey
How about this: you create a random number. Any random number, and add it to the SID. You would need to make sure that the SID has a certain length, so maybe you have to add some digits, but I guess this would serve the purpose and still be fairly simple.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
7 years 4 months ago - 7 years 4 months ago #144621 by Ben_V
Replied by Ben_V on topic Random number in anonymous survey
as proposed by @Holch something compose around:

{rand(min, max)}{SAVEDID}

=> Generate code at the end of survey

=> Generate Unique PIN for user

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 7 years 4 months ago by Ben_V.
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
7 years 4 months ago - 7 years 4 months ago #144633 by LouisGac
Replied by LouisGac on topic Random number in anonymous survey
you can also try this method, it provides number guaranteed to be random:
goo.gl/TXBwf6

:lol:
Last edit: 7 years 4 months ago by LouisGac.
The topic has been locked.
  • leviathan
  • leviathan's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 3 months ago #145024 by leviathan
Replied by leviathan on topic Random number in anonymous survey
Thank you!
I think that solution is suitable for me.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 3 months ago #145061 by holch
Replied by holch on topic Random number in anonymous survey
I hope it is not the one from Louis... ;-)

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose