Welcome to the LimeSurvey Community Forum

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

Random number in anonymous survey

More
8 years 9 months ago #144584 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.
More
8 years 9 months ago #144607 by tpartner
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.
More
8 years 9 months ago #144615 by leviathan
Actually i don't need any previous results. I need one unique number witch is related to answerer.
The topic has been locked.
More
8 years 9 months ago #144616 by tpartner
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.
More
8 years 9 months ago #144617 by holch
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.

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.
The topic has been locked.
More
8 years 9 months ago - 8 years 9 months ago #144621 by Ben_V
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: 8 years 9 months ago by Ben_V.
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • New Member
  • New Member
More
8 years 9 months ago - 8 years 9 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: 8 years 9 months ago by LouisGac.
The topic has been locked.
More
8 years 9 months ago #145024 by leviathan
Thank you!
I think that solution is suitable for me.
The topic has been locked.
More
8 years 9 months ago #145061 by holch
I hope it is not the one from Louis... ;-)

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.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose