<p>I am using E-Prime (version 3) to design an experiment. In my script I have the following</p>

<p>Variable = Random(1,100)</p>

<p>This makes my variable a random number ranging from 1 to 100.</p>

<p>I would like to make this variable be a random value pulled from a normal distribution, rather than just a random number from 1 to 100. Is there a specific command that executes this in E-Prime? Or will I have to generate more code for this?</p>

CC BY-SA 4.0
2019-09-20T14:01:37.377Z
I had a bit of a poke around the docs and didn't find a function for this. But since you have the ability to draw uniformly distributed random numbers, you can convert these to normally distributed random numbers with the Box-Muller method. There's demo code at wikipedia.org/wiki/Box–Muller_transform but you will have to translate from C to E-Prime. Hope this helps.
steveLangsford
CC BY-SA 4.0
2019-09-24T09:08:54.663Z
@steveLangsford - this sounds like a good-enough answer to me! Can you convert it to an answer? Perhaps add a link or two to the sample code?
AliceD
CC BY-SA 4.0
2019-09-24T09:10:55.793Z
I am unfamiliar with E-Prime, but can you make a number array of [1-100], draw a number, and then delete it from the array before drawing again? Hacks like this aren't the most elegant, but in the end they work.
AliceD
<experiment-design>
E-Prime Scripting Issue: Pulling a Random Number from a Normal Distribution
Kelley
# E-Prime Scripting Issue: Pulling a Random Number from a Normal Distribution

(Asked by: username_0 on 2019-09-19)

I am using E-Prime (version 3) to design an experiment. In my script I have the following

Variable = Random(1,100)

This makes my variable a random number ranging from 1 to 100.

I would like to make this variable be a random value pulled from a normal distribution, rather than just a random number from 1 to 100. Is there a specific command that executes this in E-Prime? Or will I have to generate more code for this?

**Tags:** experiment-design

> **Comments:**
> **username_1**: I had a bit of a poke around the docs and didn't find a function for this. But since you have the ability to draw uniformly distributed random numbers, you can convert these to normally distributed random numbers with the Box-Muller method. There's demo code at wikipedia.org/wiki/Box–Muller_transform but you will have to translate from C to E-Prime. Hope this helps.  
> **username_2**: @username_1 - this sounds like a good-enough answer to me! Can you convert it to an answer? Perhaps add a link or two to the sample code?  
> **username_2**: I am unfamiliar with E-Prime, but can you make a number array of [1-100], draw a number, and then delete it from the array before drawing again? Hacks like this aren't the most elegant, but in the end they work.  

---

## 0 answers

