troelsi
06-19-2009, 01:57 AM
Hello
I know that I can draw a random number from a uniform distribution using the following code:
dim number as long
dim maxval as long
dim minval as long
maxval = 20
minval = 10
randomize
Number = Int((MaxVal - MinVal + 1) * Rnd + MinVal)
However, I would like to draw a random number from a normal distribution, where I have specified the mean and the standard deviation.
How do I do that? Is it possible to use the data analysis tool via VBA. That is write a VBA code that returns a random number from a given normal distribution - perhaps using the data analysis tool.
Your help is appreciated.
Thank you
Regards Troels
I know that I can draw a random number from a uniform distribution using the following code:
dim number as long
dim maxval as long
dim minval as long
maxval = 20
minval = 10
randomize
Number = Int((MaxVal - MinVal + 1) * Rnd + MinVal)
However, I would like to draw a random number from a normal distribution, where I have specified the mean and the standard deviation.
How do I do that? Is it possible to use the data analysis tool via VBA. That is write a VBA code that returns a random number from a given normal distribution - perhaps using the data analysis tool.
Your help is appreciated.
Thank you
Regards Troels