Millisecond Forums

Randomly select 6, 12 or 24 faces (image files) and place them at randomly selected pre-defined locations

https://forums.millisecond.com/Topic20051.aspx

By mlleng13 - 11/6/2016

My problem boils down to a difficulty with generating a random subset from a list. I am not sure if this is possible, so before I drive myself crazy I figured I would come here. My specific goal is to code a task that will select a random group of faces of a specified set size from a list and then place those faces each at one of 24 pre-defined locations. I cant even seem to generate a list of random numbers, let alone do what I want to do. I already have a version of this task coded in python but I wanted it in inquisit. Should I give up, or keep trying. Below is the code I am using to test/practice using the list element.

<values>
/ test = 0
</values>

<list testList>
/ items = (5,3,4)
/ selectionrate = always
/ selectionmode = random
/ itemprobabilities = uniform
/ replace = false
/ poolsize = 50
</list>


<summarydata>
/ columns = (values.test)
</summarydata>


<text TestText>
/ items = ("testText")
/ txbgcolor = (white)
/ size = (3%, 4.5%)
/ hposition = 50%
/ vposition = 50%
/ hjustify = center
/ vjustify = center
/ erase = false
/txcolor = (black)
</text>

<trial TestTrial>
/ stimulusframes = [1 = TestText]
/ trialduration = 70
</trial>

<block 1>
/onblockbegin=
[values.test = list.testList.poolitems.1]
/ trials = [1 = TestTrial]
</block>


As I understand the pool attribute, I should be generating a pool of 50 items that are randomly selected but when I ask inquisit what the first item in the pool is, it is always 5. This doesnt seem to be very random at all. If I cant generate a random order to (at the absolute very least) shuffle my list, I cannot do what I want to do. Any help will be much appreciated.

Thanks,
Mike

By Dave - 11/6/2016

mlleng13 - Monday, November 07, 2016
My problem boils down to a difficulty with generating a random subset from a list. I am not sure if this is possible, so before I drive myself crazy I figured I would come here. My specific goal is to code a task that will select a random group of faces of a specified set size from a list and then place those faces each at one of 24 pre-defined locations. I cant even seem to generate a list of random numbers, let alone do what I want to do. I already have a version of this task coded in python but I wanted it in inquisit. Should I give up, or keep trying. Below is the code I am using to test/practice using the list element.

<values>
/ test = 0
</values>

<list testList>
/ items = (5,3,4)
/ selectionrate = always
/ selectionmode = random
/ itemprobabilities = uniform
/ replace = false
/ poolsize = 50
</list>


<summarydata>
/ columns = (values.test)
</summarydata>


<text TestText>
/ items = ("testText")
/ txbgcolor = (white)
/ size = (3%, 4.5%)
/ hposition = 50%
/ vposition = 50%
/ hjustify = center
/ vjustify = center
/ erase = false
/txcolor = (black)
</text>

<trial TestTrial>
/ stimulusframes = [1 = TestText]
/ trialduration = 70
</trial>

<block 1>
/onblockbegin=
[values.test = list.testList.poolitems.1]
/ trials = [1 = TestTrial]
</block>


As I understand the pool attribute, I should be generating a pool of 50 items that are randomly selected but when I ask inquisit what the first item in the pool is, it is always 5. This doesnt seem to be very random at all. If I cant generate a random order to (at the absolute very least) shuffle my list, I cannot do what I want to do. Any help will be much appreciated.

Thanks,
Mike


/onblockbegin=
[values.test = list.testList.poolitems.1]

You are not selecting a random item from the list here. You are merely accessing the list's 1st item, which is 5. It's always 5, because that's what you listed as the lists's 1st item. If you want to sample a random item from the list you do:

/onblockbegin=
[values.test = list.testList.nextvalue]