Howdy, Stranger!

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

Supported by

[solved] Pseudorandom order

edited January 2014 in OpenSesame


I would want that the program follows a specific order of trials presentation: I had created it yet. Is it possible (and in this case, how I could introduce it?) or is it necessary to have a block of sequence for each trial?




  • edited 7:26AM

    Hi Frederica,

    I would want that the program follows a specific order of trials presentation: I had created it yet.

    I'm not sure I understand your question? Do you mean that you would like to run your trials sequentially, rather than in random order? In order to do that you need to set 'order' to 'sequential' in the loop item that contains your trial sequence.

    is it necessary to have a block of sequence for each trial?

    Well, it's not strictly speaking necessary. A trial could also consist of a single item. But usually a trial consists of multiple items, and in that case you would put all the items that comprise the trial into a sequence.

    Does this answer your question at all?


    Buy Me A Coffee

  • edited February 2012

    Dear Sebastian,

    I’m not sure I explained very well my problem. So, I tried again but this time with more details.

    I want to use the program as a support for my experiment with minibird. In this experiment I will ask subjects to do a direct pointing movement towards a target. The target is presented on a screen and the presentation is controlled by Opensesame program.

    I have 13 different position of the target in horizontal space and because I need to be very very precious, I decided to construct 13 pictures, one for different position: I will show them in widescreen modality , setting correctly the display resolution in the Opensesame program.

    If I understood correctly, the term “sequence” refers to “what happens in one trial”. So in my case:

    Sequence = 1 text display – 2 sketchpads – 1keyboard_response – 1 logger.

    About the 2 sketchpads: the first is white empty screen; after 2 secs, the second skechtpad in which the picture is showed. All these things are under the label “LOOP”.

    And here, my doubt! As I told you, I have a pseudorandom order (basically I want to avoid that the same position is presented for two trials consecutively): every position is showed for 4 times; overall 52 trials.
    Have I to construct 52 loops (in every loop, in the second sketchpad I put the picture of interested)? Or could I just create one loop (and so one sequence) and give the program the list of trials to follow? for example:


    Trial 1 – picture 2

    Trial 2- picture 1

    Trial 3 – picture 3

    Trial 4 - picture 1


    If the second hypothesis is correct, where has this list to be introduced? In the variables setting space (point 3 of OpenSesame Tutorial?).

    Thank you in advance,


  • edited September 2013

    Hi Frederica,

    Ok, so if I understand correctly you want to create a trial sequence that is more-or-less random, but has the restriction that the same image shouldn't be shown twice in immediate succession. Is that correct?

    That's a bit tricky, but an inline_script should do the trick. First, at the start of the experiment, you create a list of (picture) numbers that meets your criteria.

    # Put this script in the prepare phase of an
    # inline_script item at the start of the
    # experiment.
    from random import shuffle
    global pic_list # Make pic_list global so we can use it later
    pic_list = range(1,14) # Create a list of nuber 1 to 13
    pic_list *= 4 # Repeat every number 4 times
    shuffle(pic_list) # Randomize the list
    # Now check if a number is repeated immediately (e.g, 9, 2, 2, 5)
    # and randomize until this is not the case
    while True:
        reshuffle = False
        for i in range(len(pic_list)-1):
            if pic_list[i] == pic_list[i+1]:
                reshuffle = True
        if not reshuffle:

    Then, at the start of a trial, you select one number and set a variable that you can use in, for example, a sketchpad, like so [my_pseudo_random_pic]. This assumes that you have named your images image01.png through image13.png.

    # Put this code in the prepare phase of an inline_script
    # item at the start of the trial sequence.
    global pic_list # Access the pic list
    pic = pic_list.pop() # Get a pic number
    # Set the variable so we can use it in a sketchpad
    self.experiment.set("my_pseudo_random_pic", "image%.2d.png" % pic)

    Regarding the loop: You don't have to define a loop variable for the picture numbers, because we handle that using these inline_scripts. But you should make sure that the block_loop has the correct length (i.e., 52).

    Hope this gets you started!


    Buy Me A Coffee

  • edited 7:26AM

    Thank you so much!!



Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games