Howdy, Stranger!

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

Supported by

[open] Random order to variables without returning

edited April 2013 in OpenSesame

Hello, I'm trying to find the suitable way to use if conditions for what I want to do. but the following link isn't helping so I need help.
http://osdoc.cogsci.nl/usage/variables-and-conditional-qifq-statements/

After I set variables to the experiment, I assigned "random" to the order, but I need it to be random without return. For example, if a certain variable contains 1-10 numbers, and I have 7 cycles, I wouldn't want any number to appear twice, as there is an option to have 7 nembers appear without any of them repeating.
(like drawing items from a sac without returning them to it).

Thank you!

Comments

  • edited 8:48AM

    The loop item does random sampling without replacement. For example, if you have a loop table like this ...

    image

    ... every number between 1 and 10 will appear exactly once. If this is not what you have in mind, could you please be a bit more specific about what you want to accomplish, and what you are doing at the moment?

    Cheers!
    Sebastiaan

  • edited 8:48AM

    yes I didn't explain myself correctly, assume I have two variables:
    shape and color, each has 8 values, and the loop in which it is has to repeat itself 7 times.
    my problem is: the same shape appears twice in these 7 cycles, which I don't want.
    I need each shape (and color) to appear only once during these 7 cycles.
    how can I use an "if" condition in order to do that?

    Thanks,
    Nagham

  • edited 8:48AM

    Ah, I see. This is not possible using only the loop item, but you can do it with a simple inline script. First, you use the loop table to define the eight shapes, as you would normally. Then, you create a list of eight colors in an inline script before the block_loop (as first item of the block_sequence, say).

    # First create a randomly ordered list of colors
    from random import shuffle
    exp.colors = ['blue', 'red', 'green', 'purple', 'yellow', 'pink', 'brown', 'magenta']
    shuffle(exp.colors)
    

    Then at the start of the trial_sequence, you pop() the last color from this list, and set it as an experimental variable, like so:

    # This script should be in the prepare phase!
    # Select the last color from the list and store it as [color]
    exp.set('color', exp.colors.pop())
    

    Hope this answers you question.

    Cheers,
    Sebastiaan

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 http://45.77.173.118/ 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