A normal random variable from a random number generator

Marisol Espinoza's Avatar

Marisol Espinoza

07 Jan, 2020 05:39 PM

Hello
I need to set variable intervals to display visual stimuli and want these intervals to have a normal distribution. Is there a method to approximate a normal distributed sampler using 'rand' or one of the other existing random number generators?

Thank you very much!
Marisol

  1. Support Staff 1 Posted by Christopher Sta... on 07 Jan, 2020 09:03 PM

    Christopher Stawarz's Avatar

    Hi Marisol,

    Probably the easiest thing would be to use Python's random module via a Python action, e.g.

    run_python_string ('import random')
    value = py_call('random.gauss', mean, std_dev)
    

    Cheers,
    Chris

  2. 2 Posted by Marisol Espinoz... on 13 Jan, 2020 11:58 PM

    Marisol Espinoza's Avatar

    Hey Chris!

    Thank you very much! it works pretty nice!

    Marisol

  3. Christopher Stawarz closed this discussion on 14 Jan, 2020 02:53 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac