PennController for IBEX › Forums › Support › Randomization question › Reply To: Randomization question
October 31, 2022 at 5:56 pm
#9650
![](https://www.pcibex.net/wp-content/uploads/2018/10/IMG_8365-e1540835663655-150x150.jpg)
Keymaster
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); fisherYates(jokings); var joking; Template( row => newTrial( "trial-" + ((joking=jokings.pop()) ? "joke" : "non-joke") , newText( "prompt" , ( joking ? row.Joke : row.NonJoke ) ).print() // ... ) .log( "joking" , joking ) )
Jeremy