Howdy, Stranger!

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

Supported by

pseudorandomizing a LDT in OSWeb

Hi everyone,

I am preparing a Lexical Decision Task to be run online and I want to make sure that there will never be more than 2 words from the same valence condition (there are 4 with the non-words) presented in a row. Does anyone know how to do that in OSWeb?

Thanks in advance!

Sophie :)


  • Hi @sophiie,

    The easiest way to deal with if your experiement was not running in a browser would be to use the constrain command in the loop's script. However, This function is not currently supported by OSWeb.

    So I can think of two options in your case:

    Option 1: You prepare your stimuli files offline using some outside programming or whatever else method you see fit to generate semi-randomized stimuli list files (for example 100 of them) that meet your criteria, you upload them to the pool, and then you set your loop to use a file source. You use some Javascript code to pick one of the 100 stimuli list files at random and you get your task to use that one to populate the trials. This method is simple from the OSWeb perspective, but it requires you to prerare your stimuli files outside Open Sesame.

    Option 2. You can generate your stimuli list within the program, at the start, using arrays in Javascript, implementing your semi-randomization there. Then once your stimuli list is ready and you start presenting your trials, you'd have to use Javascript coding to keep track of trials by creating a counter that should be incremented on every trial, and use that counter to populate the trial with the relevant stimulus information read from the arrays you created earlier. So, for this solution, you'll need to learn to program a little in Javascript.

    Here's an exampele of Javascript code that generates an array of 100 elements, each coded as 0 to 4 (which would represented for example 4 conditions) and randomizes them while making sure that the same condition is not repeated in more then 2 consecutive trials.

    function generateTrials(numTrials = 100, numConditions = 4, maxRepeats = 2) {
      let trials = [];
      let conditionCounts = Array(numConditions).fill(0);
      let lastCondition = null;
      let repeatCount = 0;
      for (let i = 0; i < numTrials; i++) {
        let condition = Math.floor(Math.random() * numConditions);
        // Check for max repeats and condition count
        while (condition === lastCondition && repeatCount >= maxRepeats || conditionCounts[condition] >= numTrials / numConditions) {
          condition = Math.floor(Math.random() * numConditions);
        // Update last condition and repeat count
        if (condition === lastCondition) {
        } else {
          repeatCount = 1;
          lastCondition = condition;
      // Final check to ensure all conditions are met equally
      if (!conditionCounts.every(count => count === numTrials / numConditions)) {
        console.log("Adjusting, please rerun.");
        return generateTrials(); // Rerun if the distribution is not perfect
      return trials;
    let trials = generateTrials();

    This is just to give you an idea of what kind of coding you'd need to write. You's have to adapt it to your own requirements, of course.

    You can find a lot of helpers about Javascript on the internet.

    Hope this helps,


    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