Howdy, Stranger!

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

Supported by

Randomize pictures of same category

edited October 2021 in OpenSesame


I'm programming an attentional task and I need some help.

The experiment has the following structure: distractor-target-response.

I have two different categories of distractors (food and neutral stimulus) and each one contains 40 pictures (food1, food2, ... / neutral1, neutral2, ...). The target can appear either the same position as the distractor (congruent trial) or the opposite position (incongruent trial).

I'm trying to make distractor images of same category appear randomized but I don´t know how to do it using javascript. I need them to follow the structure of the image.

Thank you so much for your help.


  • FabFab
    edited October 2021

    Hi @ireneruizp,

    I'm not sure I understand your description, as your table does not contain an image variable. Your table already contains a fully orthogonal distractor x distractor_position x target_position design (2x2x2) and your table's "order" property is set to random, so this will generate a random presentation of the 8 trials in the table you posted to the forum.

    I wonder whether what you mean is that there should be another variable containing the name of the image file and that you want the order of the image files randomized within the each distractor type (food/neutral). Is that what you mean?

    You can achieve this by using code to store the image files in a memory array, shuffle that array, and then populate the loop's table on the fly as the trials run.

    Coding can be achieved in Python or in Javascript, though if you plan to execute your experiment in a browser, you must use Javascript. You will find some example of this method used in the following posts (in Javascript), though in your case it would need to be adapted (see below):

    In your case, as you have two categories of distractors (food and neutral), you'd have to create two arrays, shuffle both (this would be done before the loop), and then as the task run, you'd have to implement a counter that counts the number of trials of each type in order to pick the appropriate element in the appropriate array and use it to define the picture that should appear on the screen. So, say trial 23 is currently running: code in the trial sequence would check what condition we're currently in. Say it is the food distractor condition. The code would add 1 to the food trials counter. Let's say this is the 12th food trial so far. The code would then select the 11th element in the shuffled array of food picture filenames (11th because array start at 0, not at 1).

    Hope this help. Let me know if you need further clarification or even load up your task so that I can take a look and suggest a more specific solution.

    Good luck,


    PS: Are you planning to run this through OSWeb? (if you are, I might move this thread to the OSWeb forum)

    Buy Me A Coffee

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