Howdy, Stranger!

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

Supported by

[solved] randomizing a sequence of four blocks

edited July 2013 in OpenSesame

Hi Sebastian.

I have this experimental structure:

My experiment
- experimental loop
-- block sequence
--- block sequence 1
--- block sequence 2
--- block sequence 3
--- block sequence 4

Inside each block sequence there is a trial loop with a trial sequence inside.
I want to randomizing the four sequences inside the block sequence, but simply setting the random order option in the experimental loop doesn't work (I don't know why...).

In this post I have read that a solution for a similar problem is to set a order variable (in my case with the values 1, 2, 3, 4) in the experimental loop, an then use the "run if" statemant for all the permutations of the blocks order. But in my case I have to set 4! = 24 permutations! :((

There does exist an easier method to randomizing?




  • edited July 2013

    Hi Andrea,

    Right, if you set a loop to random, it will only randomize the order of the loop. The order of the items in a sequence is always fixed. Still, you can mimic a random sequence quite easily with a simple inline_script. See below, some instructions are added as code comments.


    from random import shuffle
    # Uncomment for 0.25 and before
    # exp = self.experiment
    # Create a list of items that are part of the sequence
    # These items must be present somewhere in the experiment.
    # An easy solution is to add them to a dummy_sequence at
    # the start of the trial and set the 'run if' statement of
    # the dummy_sequence to 'never'.
    item_list = ['item1', 'item2', 'item3', 'item4']
    # Randomize the item order. Of course you can also do more
    # complicated things, such as have the order depend on the
    # subject nr, etc.
    # First, prepare all items
    for item in item_list:
    # Now run them!
    for item in item_list:

    Buy Me A Coffee

  • edited 7:59AM

    I have tried it just now and it works like a charm. You are the Genie of the Lamp. :)

    Thank you very much, Sebastian.

  • gmzgmz
    edited 7:59AM

    I am brand new in Open Sesame and I know nothing about Python (I have been using SuperLab before). I have been trying to what Sebastiaan suggests, but I am not getting results. Could somebody explain it to me like "Open Sesame for dummies"?
    I need to run several blocks of 36 sequences (1 fix point+1 sentence+ 1 question about the previous sentence) in a random way (the presentation of the 36 pairs of sentence+question must be random), and collect RTs and yes/no answers.
    I understand the structure is pretty much like the one Andrea has, but with more sequences.
    And another thing: I am having problems with the excel with the collected data. It seems to be all mixed up and RTs are not recorded (or so it seems)...and I don´t know how to solve it.


  • Hi dear
    please I,m looking for your help
    i have 10 universities i want to do the randomization to allocate it for intervention group and control group and i want to use the block methode who can i do it please

  • Hey Sebastian,

    It tried to use the code you provided above. However, I don't understand this part:

    # Create a list of items that are part of the sequence
    # These items must be present somewhere in the experiment.
    # An easy solution is to add them to a dummy_sequence at
    # the start of the trial and set the 'run if' statement of
    # the dummy_sequence to 'never'.
    item_list = ['item1', 'item2', 'item3', 'item4']

    My experiment looks like that:

    And my goal is to randomize available_unavailable_mother, lovable_unlovable_self, and avialable_unavialble_father.

    Thank you in advance.

    Best, Laura

  • Hi @L_Geissert ,

    You could put the three sequence s inside another containerloop - sequence structure. Then, in the container loop , you create a variable that determines which of the three sequence s is executed. And in the container sequence you use a run-if statement to determine which of that (sub) sequence is executed. Does that make sense?

    In the example below I used sketchpad s. In your case, you would replace these by the three sequence s that you want to randomize.



    Buy Me A Coffee

  • Hey Sebastiaan,

    it makes sense, 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