Adding an exponential distribution of timing to a routine

Hello!

I have a task that is composed of 8 routines on a loop. I would like one of the routines to to be shown for a varied length of time based on an exponential distribution. I would like the routine to be displayed anywhere from 1 second to and infinite amount of time (I have included a keyboard in the routine that will allow the participant to opt out at any time).

I am wondering how to get the timing of this routine on an exponential distribution so that each cycle of the loop has the routine display for a different amount of time. Thank you!! (Ps I have mostly been using builder and sprinting bits of code where I need it).

Hi,

Builder imports the numpy library (as np), giving you access to this function:

np.random.exponential()

Docs here:

https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.random.exponential.html

A post was split to a new topic: Select from different reward values across trials