Randomization question

PennController for IBEX Forums Support Randomization question

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #9647

    Hi, I was wondering if there is a workaround for a particular type of randomization.
    I’m doing a study on humor comprehension. My stimuli are 20 jokes, and every row there is a joke in column 2 and a similarly-structured non-joke in column 3. I want to randomly select 10 rows to present as jokes and 10 rows to present as non-jokes. Then I want to shuffle the order. The last part I understand I can do in sequence, but how would I, in the Template(), make a random set of 10 trials based on column 2 and 10 trials based on column 3?


    Hi Jeff,

    If you know in advance that you want 10 trials to use column 2 (let’s call it “Joke”) and 10 to use column 3 (let’s call it “NonJoke”) you can simply generate an array of 20 entries, half true half false, shuffle that array and scan it within Template:

    Sequence( rshuffle("trial-joke","trial-non-joke") ) 
    var jokings = [...new Array(20)].map((v,i)=>i<10);
    var joking;
    Template( row =>
      newTrial( "trial-" + ((joking=jokings.pop()) ? "joke" : "non-joke") ,
        newText( "prompt" , ( joking ? row.Joke : row.NonJoke ) ).print()
        // ...
      .log( "joking" , joking )


Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.