Howdy, Stranger!

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

Supported by

randomzation

Hello!

I need to generate random numbers to show sequentially on a sketchpad. I put in the code in an inline script

import random
var.random_numbers = random.randint(0,9)

It generates the numbers that I need, but I must prevent it from generating the same numbers twice in a row. do you have any idea how I could do that? I know it's basic, but I am new to Open Sesame and Python (coding in general actually)

Thank you!

Comments


  • This is how the experiment looks.

  • Hello Doris,

    For this I would create a variable stocking the last number presented, then removing the value from the possible choice.

    Please find the script attached.

    Best,

    Sylvain

  • Thank you!

Sign In or Register to comment.