Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

RSVP Stream

I am creating an attentional blink experiment where the RSVP stream is a 680 item stream of alphabets randomly sampled from letters C to Z. There are also As and Bs that randomly appear in this stream, 10 times each at varying position intervals of 14 to 34 letters. How do I use random.choice function to create this stream. If random.choice cannot not be used for this, please help me with some other function that can do this.




  • Hi rayna,

    Maybe this script helps you:

    import random
    stimuli = []
    number_stimuli_desired = 680
    # make a default set of values to pull from
    letter_set = ['z','y','c','d','e']
    # first make the distractor lists
    for n in range(number_stimuli_desired):
    # then add the targets
    targets = ['a','b']*10 # 20 targets
    while True:
         idx = random.randint(14,680)
         add_idx = True
         for n in range(idx-14:idx+14):
             if stimuli[n] in ['a','b']:
                  add_idx = False
         if add_idx:
         if len(targets)==0:


Sign In or Register to comment.