Back
Login
Register
Login
Register
Millisecond Forums
Home
»
Millisecond Forums
»
Inquisit 5
»
Generate Participant ID from JavaScript
Generate Participant ID from JavaScript
Post Reply
Like
2
Generate Participant ID from JavaScript
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
IR1999
IR1999
posted 4 Years Ago
ANSWER
Topic Details
Share Topic
Group: Forum Members
Posts: 1,
Visits: 2
Hi,
I want to generate a participant ID from a custom JavaScript code (see below) but when I my inquisit study on millisecond, the number comes up as a secondary notification and doesn't let me start the study. I am confused as to out to input a number I output from javascript back into inquisit. Or is this not possible?
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
// Used like so
var arr = [2, 11, 37, 42];
arr = shuffle(arr);
console.log(arr);
alert(arr[0])
Reply
Like
2
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Threaded View
Threaded View
Generate Participant ID from JavaScript
IR1999
-
4 Years Ago
To work properly, your code needs to return the result, not pop an...
Dave
-
4 Years Ago
Post Reply
Like
2
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Facebook
Explore
Messages
Mentions
Search