Millisecond Forums

Random number generator

https://forums.millisecond.com/Topic14761.aspx

By paughl - 10/29/2014

Hi again,

Does Inquisit have a simple random number generator?

I'm wanting to connect my inquisit script to MTurk, and to verify that participants have completed the task, I want to generate and display a random number within a set range (eg: higher than 160,000 and lower than 165,000) at the final inquisit page. Participants will then need to input this number into Mturk, allowing me to verify that they completed the task if the number is within the specified range.

Thanks in advance,
paul
By maf1974 - 10/29/2014

Hi Paul,
I did this by combining the Inquisit survey with a Qualtrics survey.  You may be able to do this purely in Inqusit alone but I don't know how. 

I set up a Qualtrics survey to provide participants with an information and consent page, asked them a few demographic questions, randomly assigned them to some experimental groups and then redirected them to the Inquisit link to do the Age IAT (the dependent variable in my study). After completing the IAT they were redirected back to Qualtrics which used an embedded web service element to generate random confirmation codes that participants then enter in to MTURK to confirm their participation.

Are you using any other survey provider, or just Inquisit?
Mike
By paughl - 10/29/2014

Thanks for your response Mike. No, just using Inquisit.
By Dave - 10/29/2014

Yes, Inquisit has a rand() function (and others) you can use to do this easily. See the functions reference for details.

<values>
/ myvalue = 0
</values>

<trial mytrial>
/ ontrialbegin = [values.myvalue = floor(rand(160001,165000))]
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("Your random code: <%values.myvalue%>")
</text>
By paughl - 10/30/2014

Thanks a bunch Dave. Champ!