0 votes
in SoSci Survey (English) by s139639 (360 points)

Random generated code for MTurk.

1 Answer

0 votes
by SoSci Survey (330k points)

Sure, but the point is that you may create duplicated keys, if creting them randomly.

Practically, I recommend to (unique) create random codes using the "access code" feature of SoSci Survey and copy them into a random generator.

Nonetheless, here's a little code to create random strings.

$length = 10;
$chars = '23456789ABCDEFGHKLMNPQRSTUVWXYZ';
$maxChar = strlen($chars)-1;
for ($i=0; $i<$length; $i++) {
  $random = mt_rand(0, $maxChar);  // Can also use: random(0, $maxChar)
  $s.= $chars[$random];
}

html('<p>Code: '.$s.'</p>');
put('IV01_01', $s);

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...