One quick note: if your experiment requires precise timing (e.g., accuracy on the order of milliseconds when presenting stimuli or recording reaction time), implementing it in Unity is not a good idea. [Psychtoolbox][1] (which works with MATLAB and to a lesser extent its open-source alternative Octave) would be a better choice. Building the experiment program in C++ using a reliable multimedia library such as [SFML][2] is probably the best option, but requires more development time.
Regarding your actual question: there are multiple ways to approach random-selection-without-repetition tasks like these. One method is to maintain a [List][3] of all items (in this case, scene indices) and remove an item from the list if/when it gets selected.
For example, you could have two "master" lists, one containing the A ("old") conditions and one for the B ("new") conditions. When configuring an individual block, you'd want to make a distinct copy of the A conditions list (since the A conditions are only forbidden from repeating within a given block, not across the experiment as a whole). The procedure for choosing scenes for a block is then:
- Make a distinct copy of the master list of A scenes.
- For each scene within the current block, decide whether to choose an A scene or a B scene (since you have 8 of each per block, you could simply keep track of how many A and B scenes you've used for the block so far and randomly choose to select an A scene or a B scene 50/50 until one of the two types runs out).
- When choosing an A scene, randomly select (e.g., using [Random.Range][4]) an A scene from the local copy of the A list and then remove that scene from the list so it won't be selected again (of course, add it to another list containing the scenes to use for the current block). Since this A list is local to the current block, the master A list is not altered and thus all A scenes are available during the next block when a new distinct copy of the master A list is made.
- When choosing a B scene, randomly select a B scene from the master B list and then remove that scene from the list to prevent it being selected again. Since the selected scene is removed from the master B list, it won't be available to the any subsequent blocks.
Hopefully that helps. If you're quite new to programming it might be a bit high-level, so feel free to ask if you need clarification.
[1]: http://psychtoolbox.org/
[2]: http://www.sfml-dev.org/
[3]: https://msdn.microsoft.com/en-us/library/6sh2ey19%28v=vs.110%29.aspx
[4]: http://docs.unity3d.com/ScriptReference/Random.Range.html
↧