Skip to content
Discussion options

You must be logged in to vote

Hi @xliu382, sorry for the delay. Your approach of sampling from the timeline_variables array using the sample parameter makes sense for situations when you only need to do the sampling once, without re-using the same items. But in your case I would instead do the random sampling outside of the trial procedure, using jsPsych's randomization functions, so that you can store the randomly-selected items and re-use them later.

Here's one approach that might work:

// array with all 60 questions
var all_questions = [ 
  {data: { i: 1 }, q: 'Q1'},
  {data: { i: 2 }, q: 'Q2'},
  {data: { i: 3 }, q: 'Q3'},
  {data: { i: 4 }, q: 'Q4'},
  {data: { i: 5 }, q: 'Q5'},
  {data: { i: 6 }, q: 'Q6'},
  // ...

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@xliu382
Comment options

Answer selected by xliu382
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants