09-09-2020, 11:26 AM
Generate a Random Number
Required Experiment Builder Version: 1.10.1025 or higher
EyeLink Required: Yes
Type: Complete Example
Difficulty Level: Easy
This example illustrates:
These examples modify the Simple experiment provided with the SR Research Experiment Builder Examples to demonstrate how to generate a random number and set it to the duration of a timer trigger. However, the random number could be assigned to any variable and used for many different purposes. The Simple example displays a single word on each trial.
NOTE: Please see our Randomizing Variables Outside of Data Source in Experiment Builder and Data Source Randomization in Experiment Builder Webinars for more randomization methods.
Instructions:
Simple_Timer_Duration_Frames_Random_Number.ebz (Size: 29.06 KB / Downloads: 24)
Simple_Timer_Duration_Random_Number.ebz (Size: 28.86 KB / Downloads: 29)
Required Experiment Builder Version: 1.10.1025 or higher
EyeLink Required: Yes
Type: Complete Example
Difficulty Level: Easy
This example illustrates:
- How to use Python function random.randint() to generate a random number
- How to set Duration Type property of the Timer trigger in either msec or frames
These examples modify the Simple experiment provided with the SR Research Experiment Builder Examples to demonstrate how to generate a random number and set it to the duration of a timer trigger. However, the random number could be assigned to any variable and used for many different purposes. The Simple example displays a single word on each trial.
- The Simple_Timer_Duration_Random_Number.ebz example sets the duration of the word to a random number of msec. Note, the text will be displayed for slightly more or less time because all screen changes are time-locked to the screen refresh cycle.
- The Simple_Timer_Duration_Frames_Random_Number.ebz example sets the duration of the text to 60-600 refresh rate.
NOTE: Please see our Randomizing Variables Outside of Data Source in Experiment Builder and Data Source Randomization in Experiment Builder Webinars for more randomization methods.
Instructions:
- Download the Simple_Timer_Duration_Random_Number.ebz and / or the Simple_Timer_Duration_Frames_Random_Number.ebz example from this message.
- Launch the Experiment Builder application.
- Unpack the file/s to a location on your Experiment Builder PC with "File menu -> Unpack".
- Open the project in Experiment Builder.
- Deploy the project to a new folder.
- Run the Simple_Timer_Duration_Random_Number.exe and / or the Simple_Timer_Duration_Frames_Random_Number.exe from the deployed directory.
Simple_Timer_Duration_Frames_Random_Number.ebz (Size: 29.06 KB / Downloads: 24)
Simple_Timer_Duration_Random_Number.ebz (Size: 28.86 KB / Downloads: 29)