## Shuffle items in list to use same order of stimuli throughout...

 Author Message Tahwan Associate Member Group: Forum Members Posts: 5, Visits: 20 After the fast reply to my last question I am trying it again. I am very suprised I couldn't find a previous post asking the same thing, because it appears to me to be a standard feature I am looking for:I have four stimuli. I want the order of the stimuli randomized per subject at the beginning of the experiment (counterbalancing between subjects). Then I want to use the same order of stimuli at various points of the experiment.  So lets say I have four stimuli:/1 = "flower1.jpg"/2 = "flower2.jpg"/3 = "flower3.jpg"/4 = "flower4.jpg"I could call a specific item in "picture" using select: / items = Simuli_Portraits/ select = 1All I would need is a shuffeled array of numbers that I could call one by one via select, let's say /select = order_stimuli(1), where order_stimuli is a random order of the numbers 1-4I can also create a sequence of numbers via list:/ items = (1,4)/ selectionmode = random/ selectionrate = experimentYet, what I don't understand is whether this really provides me a list of numbers or only one number. All I need is a function that shuffles an array of numbers, in which I can call the x-th element of the array.I was also thinking about some workaround methods: 1. Manually creating all possible orders (a list of items with all combination "1234", "1243, "1324", ..., "4321") as randomly choosing one. Here again I have the problem that I don't know how to call the x-th element of the string/number/array for select in the picture function.2. Using some complicated randomization with branches at the beginning of the experiment to create a randomized order in items, also not having a clue how that could work.I am very much into the logic of (dynamical) indexing that I might miss the very obvious solution on how to keep randomization consistent throughout multiple blocks of the experiment. Thank you for your help! Dave Supreme Being Group: Administrators Posts: 9.3K, Visits: 41K +xTahwan - Tuesday, April 17, 2018After the fast reply to my last question I am trying it again. I am very suprised I couldn't find a previous post asking the same thing, because it appears to me to be a standard feature I am looking for:I have four stimuli. I want the order of the stimuli randomized per subject at the beginning of the experiment (counterbalancing between subjects). Then I want to use the same order of stimuli at various points of the experiment.  So lets say I have four stimuli:/1 = "flower1.jpg"/2 = "flower2.jpg"/3 = "flower3.jpg"/4 = "flower4.jpg"I could call a specific item in "picture" using select: / items = Simuli_Portraits/ select = 1All I would need is a shuffeled array of numbers that I could call one by one via select, let's say /select = order_stimuli(1), where order_stimuli is a random order of the numbers 1-4I can also create a sequence of numbers via list:/ items = (1,4)/ selectionmode = random/ selectionrate = experimentYet, what I don't understand is whether this really provides me a list of numbers or only one number. All I need is a function that shuffles an array of numbers, in which I can call the x-th element of the array.I was also thinking about some workaround methods: 1. Manually creating all possible orders (a list of items with all combination "1234", "1243, "1324", ..., "4321") as randomly choosing one. Here again I have the problem that I don't know how to call the x-th element of the string/number/array for select in the picture function.2. Using some complicated randomization with branches at the beginning of the experiment to create a randomized order in items, also not having a clue how that could work.I am very much into the logic of (dynamical) indexing that I might miss the very obvious solution on how to keep randomization consistent throughout multiple blocks of the experiment. Thank you for your help!What you do is this: Have one containing the values 1 to 4 set to random selection. Have another empty set to sequential selection. Sample four values from the 1st list /onexptbegin and store them in the empty list. You now have a fixed randomly generated sequence which you can use for selection as needed. In a nutshell:/ poolsize = 4/ selectionrate = always/ selectionmode = random/ replace = false/ selectionmode = sequence/ onexptbegin = [    list.fixedseq.appenditem(list.rand.nextindex);    list.fixedseq.appenditem(list.rand.nextindex);    list.fixedseq.appenditem(list.rand.nextindex);    list.fixedseq.appenditem(list.rand.nextindex);]/ blocks = [1=myblock]/ trials = [1-16 = mytrial]/ stimulusframes = [1=mytext]/ validresponse = (57)/ items = myitems/ select = list.fixedseq.nextvalue/ 1 = "A"/ 2 = "B"/ 3 = "C"/ 4 = "D"Hope this helps. Dave Supreme Being Group: Administrators Posts: 9.3K, Visits: 41K +xDave - Tuesday, April 17, 2018+xTahwan - Tuesday, April 17, 2018After the fast reply to my last question I am trying it again. I am very suprised I couldn't find a previous post asking the same thing, because it appears to me to be a standard feature I am looking for:I have four stimuli. I want the order of the stimuli randomized per subject at the beginning of the experiment (counterbalancing between subjects). Then I want to use the same order of stimuli at various points of the experiment.  So lets say I have four stimuli:/1 = "flower1.jpg"/2 = "flower2.jpg"/3 = "flower3.jpg"/4 = "flower4.jpg"I could call a specific item in "picture" using select: / items = Simuli_Portraits/ select = 1All I would need is a shuffeled array of numbers that I could call one by one via select, let's say /select = order_stimuli(1), where order_stimuli is a random order of the numbers 1-4I can also create a sequence of numbers via list:/ items = (1,4)/ selectionmode = random/ selectionrate = experimentYet, what I don't understand is whether this really provides me a list of numbers or only one number. All I need is a function that shuffles an array of numbers, in which I can call the x-th element of the array.I was also thinking about some workaround methods: 1. Manually creating all possible orders (a list of items with all combination "1234", "1243, "1324", ..., "4321") as randomly choosing one. Here again I have the problem that I don't know how to call the x-th element of the string/number/array for select in the picture function.2. Using some complicated randomization with branches at the beginning of the experiment to create a randomized order in items, also not having a clue how that could work.I am very much into the logic of (dynamical) indexing that I might miss the very obvious solution on how to keep randomization consistent throughout multiple blocks of the experiment. Thank you for your help!What you do is this: Have one containing the values 1 to 4 set to random selection. Have another empty set to sequential selection. Sample four values from the 1st list /onexptbegin and store them in the empty list. You now have a fixed randomly generated sequence which you can use for selection as needed. In a nutshell:/ poolsize = 4/ selectionrate = always/ selectionmode = random/ replace = false/ selectionmode = sequence/ onexptbegin = [    list.fixedseq.appenditem(list.rand.nextindex);    list.fixedseq.appenditem(list.rand.nextindex);    list.fixedseq.appenditem(list.rand.nextindex);    list.fixedseq.appenditem(list.rand.nextindex);]/ blocks = [1=myblock]/ trials = [1-16 = mytrial]/ stimulusframes = [1=mytext]/ validresponse = (57)/ items = myitems/ select = list.fixedseq.nextvalue/ 1 = "A"/ 2 = "B"/ 3 = "C"/ 4 = "D"Hope this helps.Oh, and if you have several fixed orders you wish to counterbalance between subjects, you can do this like so, by essentially nesting lists:/ items = (list.order1.nextvalue, list.order2.nextvalue)/ selectionmode = values.ordernumber/ items = (1,2,3,4)/ selectionmode = sequence/ items = (4,3,2,1)/ selectionmode = sequence/ ordernumber = 1/ onexptbegin = [    values.ordernumber = 1;]/ blocks = [1=myblock]/ subjects = (1 of 2)/ groupassignment = groupnumber/ onexptbegin = [    values.ordernumber = 2;]/ blocks = [1=myblock]/ subjects = (2 of 2)/ groupassignment = groupnumber/ trials = [1-16 = mytrial]/ stimulusframes = [1=mytext]/ validresponse = (57)/ items = myitems/ select = list.orders.nextvalue/ 1 = "A"/ 2 = "B"/ 3 = "C"/ 4 = "D" Tahwan Associate Member Group: Forum Members Posts: 5, Visits: 20 +xDave - Tuesday, April 17, 2018+xDave - Tuesday, April 17, 2018+xTahwan - Tuesday, April 17, 2018After the fast reply to my last question I am trying it again. I am very suprised I couldn't find a previous post asking the same thing, because it appears to me to be a standard feature I am looking for:I have four stimuli. I want the order of the stimuli randomized per subject at the beginning of the experiment (counterbalancing between subjects). Then I want to use the same order of stimuli at various points of the experiment.  So lets say I have four stimuli:/1 = "flower1.jpg"/2 = "flower2.jpg"/3 = "flower3.jpg"/4 = "flower4.jpg"I could call a specific item in "picture" using select: / items = Simuli_Portraits/ select = 1All I would need is a shuffeled array of numbers that I could call one by one via select, let's say /select = order_stimuli(1), where order_stimuli is a random order of the numbers 1-4I can also create a sequence of numbers via list:/ items = (1,4)/ selectionmode = random/ selectionrate = experimentYet, what I don't understand is whether this really provides me a list of numbers or only one number. All I need is a function that shuffles an array of numbers, in which I can call the x-th element of the array.I was also thinking about some workaround methods: 1. Manually creating all possible orders (a list of items with all combination "1234", "1243, "1324", ..., "4321") as randomly choosing one. Here again I have the problem that I don't know how to call the x-th element of the string/number/array for select in the picture function.2. Using some complicated randomization with branches at the beginning of the experiment to create a randomized order in items, also not having a clue how that could work.I am very much into the logic of (dynamical) indexing that I might miss the very obvious solution on how to keep randomization consistent throughout multiple blocks of the experiment. Thank you for your help!What you do is this: Have one containing the values 1 to 4 set to random selection. Have another empty set to sequential selection. Sample four values from the 1st list /onexptbegin and store them in the empty list. You now have a fixed randomly generated sequence which you can use for selection as needed. In a nutshell:/ poolsize = 4/ selectionrate = always/ selectionmode = random/ replace = false/ selectionmode = sequence/ onexptbegin = [    list.fixedseq.appenditem(list.rand.nextindex);    list.fixedseq.appenditem(list.rand.nextindex);    list.fixedseq.appenditem(list.rand.nextindex);    list.fixedseq.appenditem(list.rand.nextindex);]/ blocks = [1=myblock]/ trials = [1-16 = mytrial]/ stimulusframes = [1=mytext]/ validresponse = (57)/ items = myitems/ select = list.fixedseq.nextvalue/ 1 = "A"/ 2 = "B"/ 3 = "C"/ 4 = "D"Hope this helps.Oh, and if you have several fixed orders you wish to counterbalance between subjects, you can do this like so, by essentially nesting lists:/ items = (list.order1.nextvalue, list.order2.nextvalue)/ selectionmode = values.ordernumber/ items = (1,2,3,4)/ selectionmode = sequence/ items = (4,3,2,1)/ selectionmode = sequence/ ordernumber = 1/ onexptbegin = [    values.ordernumber = 1;]/ blocks = [1=myblock]/ subjects = (1 of 2)/ groupassignment = groupnumber/ onexptbegin = [    values.ordernumber = 2;]/ blocks = [1=myblock]/ subjects = (2 of 2)/ groupassignment = groupnumber/ trials = [1-16 = mytrial]/ stimulusframes = [1=mytext]/ validresponse = (57)/ items = myitems/ select = list.orders.nextvalue/ 1 = "A"/ 2 = "B"/ 3 = "C"/ 4 = "D"Thank you very much for your fast response. Unfortunately it is not solving my problem. "/ select = list.orders.nextvalue" is not working for me, because I do not always want the "next value". I want participants to judge 4 images. First regarding one trait, then regarding another trait and so on. The participant has several options to get additional information, branching to several different pages/trials. Easiest would be a function "/ select = list.orders.1", calling the first number of the fixed sequence list "fixedseq" whenever I need to. Working with nextvalue would drive me crazy, because I want to call the same number in different blocks.A different idea: I could create a list of all combinations as strings, call the n-th position via some regex (if possible), convert that string to a number that could be used for / select". For example would "`/a{2}/`" extract the third value of a string "3412", providing me a "1". But I neither know whether Regey works nor whether it is possible to to use/convert the string to a number usable by "/ select". Tahwan Associate Member Group: Forum Members Posts: 5, Visits: 20 +xDave - Tuesday, April 17, 2018+xDave - Tuesday, April 17, 2018+xTahwan - Tuesday, April 17, 2018After the fast reply to my last question I am trying it again. I am very suprised I couldn't find a previous post asking the same thing, because it appears to me to be a standard feature I am looking for:I have four stimuli. I want the order of the stimuli randomized per subject at the beginning of the experiment (counterbalancing between subjects). Then I want to use the same order of stimuli at various points of the experiment.  So lets say I have four stimuli:/1 = "flower1.jpg"/2 = "flower2.jpg"/3 = "flower3.jpg"/4 = "flower4.jpg"I could call a specific item in "picture" using select: / items = Simuli_Portraits/ select = 1All I would need is a shuffeled array of numbers that I could call one by one via select, let's say /select = order_stimuli(1), where order_stimuli is a random order of the numbers 1-4I can also create a sequence of numbers via list:/ items = (1,4)/ selectionmode = random/ selectionrate = experimentYet, what I don't understand is whether this really provides me a list of numbers or only one number. All I need is a function that shuffles an array of numbers, in which I can call the x-th element of the array.I was also thinking about some workaround methods: 1. Manually creating all possible orders (a list of items with all combination "1234", "1243, "1324", ..., "4321") as randomly choosing one. Here again I have the problem that I don't know how to call the x-th element of the string/number/array for select in the picture function.2. Using some complicated randomization with branches at the beginning of the experiment to create a randomized order in items, also not having a clue how that could work.I am very much into the logic of (dynamical) indexing that I might miss the very obvious solution on how to keep randomization consistent throughout multiple blocks of the experiment. Thank you for your help!What you do is this: Have one containing the values 1 to 4 set to random selection. Have another empty set to sequential selection. Sample four values from the 1st list /onexptbegin and store them in the empty list. You now have a fixed randomly generated sequence which you can use for selection as needed. In a nutshell:/ poolsize = 4/ selectionrate = always/ selectionmode = random/ replace = false/ selectionmode = sequence/ onexptbegin = [    list.fixedseq.appenditem(list.rand.nextindex);    list.fixedseq.appenditem(list.rand.nextindex);    list.fixedseq.appenditem(list.rand.nextindex);    list.fixedseq.appenditem(list.rand.nextindex);]/ blocks = [1=myblock]/ trials = [1-16 = mytrial]/ stimulusframes = [1=mytext]/ validresponse = (57)/ items = myitems/ select = list.fixedseq.nextvalue/ 1 = "A"/ 2 = "B"/ 3 = "C"/ 4 = "D"Hope this helps.Oh, and if you have several fixed orders you wish to counterbalance between subjects, you can do this like so, by essentially nesting lists:/ items = (list.order1.nextvalue, list.order2.nextvalue)/ selectionmode = values.ordernumber/ items = (1,2,3,4)/ selectionmode = sequence/ items = (4,3,2,1)/ selectionmode = sequence/ ordernumber = 1/ onexptbegin = [    values.ordernumber = 1;]/ blocks = [1=myblock]/ subjects = (1 of 2)/ groupassignment = groupnumber/ onexptbegin = [    values.ordernumber = 2;]/ blocks = [1=myblock]/ subjects = (2 of 2)/ groupassignment = groupnumber/ trials = [1-16 = mytrial]/ stimulusframes = [1=mytext]/ validresponse = (57)/ items = myitems/ select = list.orders.nextvalue/ 1 = "A"/ 2 = "B"/ 3 = "C"/ 4 = "D"Sorry, in fact it does work, because I can call the x-th element of the list via list.fixedseq.x, for example list.fixedseq.2. Thank you very much!