Welcome to the LimeSurvey Community Forum

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

Generate code at the end of survey - for mTurk

More
8 years 11 months ago #128672 by EmE9
These are all excellent suggestions. I will try to tweek the code a bit, but I'm kinda hoping that the chances for a repeat are pretty low for the number of participants that I am looking for.

All the best,
The topic has been locked.
More
8 years 11 months ago #128685 by Ben_V

tpartner wrote: You can pad it with zeros depending on the length.


Brillant!

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)
The topic has been locked.
More
8 years 11 months ago #128703 by jelo

Ben_V wrote:

Code:
{if(!is_empty(PIN),PIN,substr(time()*rand() , 3 ,6))}
(IMHO, with 200 participants, the probability of duplicate PIN outputs, may be the same than for of a sudden meteor shower on the server)

Depends on the PHP rand implementation. Is rand() in EM the php rand() function.

Always interesting to look at the comments of these PHP functions.
php.net/manual/en/function.rand.php

Many are old and may no longer valid with current PHP versions but there is dependency to other code parts (like libc rand()) which can change from environment to environment.

The uniqid function shows some interesting comments too.
php.net/manual/en/function.uniqid.php

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: Ben_V
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose