Shuffling a list with a constraint
Posted
by
500
on Stack Overflow
See other posts from Stack Overflow
or by 500
Published on 2011-11-19T17:45:23Z
Indexed on
2011/11/19
17:51 UTC
Read the original article
Hit count: 177
Preparing a new psychophysic experiment, I have 48 original stimuli displayed 4 times (4 conditions). Resulting in 192 trials. Trying to randomize the order of presentation during the experiment, I need to maximize the distance between the 4 display of the same original stimuli.
Please Consider :
Table[{j, i}, {j, Range[48]}, {i, Range[4]}]
Where j is the original stimuli number and i the condition
Output Sample :
{{1, 1}, {1, 2}, {1, 3}, {1, 4},
{2, 1}, {2, 2}, {2, 3}, {2, 4},
...
{47, 1}, {47, 2}, {47, 3},{47, 4},
{48, 1}, {48, 2}, {48, 3}, {48, 4}}
How could I shuffle the order of presentation of those 192 items, maximizing the distance between identical item with regard to j the original stimuli number ?
© Stack Overflow or respective owner