PennController for IBEX › Forums › Support › Choosing subet of items to present › Reply To: Choosing subet of items to present
April 28, 2020 at 10:55 am
#5146
![](https://www.pcibex.net/wp-content/uploads/2018/10/IMG_8365-e1540835663655-150x150.jpg)
Keymaster
Just to double-check: your table defines 90 filler items whose ‘number’ label goes from 1 to 90, right?
When I test it I do get items whose number is over 45, but they indeed seem massively underrepresented. It seems to improve a bit when changing the > comparison when randomly sorting the indices for a >= comparison
Here’s my full script if you want to compare with yours:
PennController.ResetPrefix(null) let myTable = "type,number,text\n" for (let i = 0; i < 90; i++) myTable += "filler,"+Number(i+1)+",textfiller"+i+"\ntest,"+Number(i+1)+",texttest"+i+"\n"; AddTable("myTable", myTable) Sequence( randomize(anyOf(startsWith("test"),startsWith("filler"))) ) numberRows_fillers = 90; numberDraws_fillers = 45; randomIDs_fillers = [...new Array(numberRows_fillers)].map((v,i)=>i).sort(v=>Math.random()>=0.5).splice(1,numberDraws_fillers); Template( GetTable("myTable").filter( r => r.type=="filler" && randomIDs_fillers.indexOf(Number(r.number))>-1 ), row => newTrial( "filler-"+row.number , newText("filler").print(),newButton(row.text).print().wait() ) ) Template( GetTable("myTable").filter( r => r.type=="test" && randomIDs_fillers.indexOf(Number(r.number))>-1 ), row => newTrial( "test-"+row.number , newText("test").print(),newButton(row.text).print().wait() ) )
Jeremy