Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you are returning a horizontal array to the worksheet, would this idea
work? Function RandNormCorr(mean1, sd1, mean2, sd2, corr) Dim z1 As Double 'Variant Dim z2 As Double 'Variant Dim x As Double Dim y As Double ' gauss is a random number generation function z1 = gauss z2 = gauss x = z1 * Sqr((1 + corr) / 2) + z2 * Sqr((1 - corr) / 2) y = z1 * Sqr((1 + corr) / 2) - z2 * Sqr((1 - corr) / 2) RandNormCorr = Array(mean1 + x * sd1, mean2 + y * sd2) End Function Just another version of your equation if I didn't make a mistake... Function RandNormCorr(mean1, sd1, mean2, sd2, corr) Dim z1 As Double Dim z2 As Double Dim x As Double Dim y As Double ' gauss is a random number generation function z1 = gauss z2 = gauss x = (Sqr(1 + corr) * z1 + Sqr(1 - corr) * z2) / Sqr(2) y = x - z2 * Sqr(2 - 2 * corr) RandNormCorr = Array(mean1 + x * sd1, mean2 + y * sd2) End Function -- Dana DeLouis Using Windows XP & Office XP = = = = = = = = = = = = = = = = = "jomni " wrote in message ... Oh yeah! that's because I did not indicate Option Base 1 Thanks! Need to get used to this. --- Message posted from http://www.ExcelForum.com/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Create a List Output from a Horizontal Array Input | Excel Worksheet Functions | |||
Prevent cell/array references from changing when altering/moving thecell/array | Excel Discussion (Misc queries) | |||
meaning of : IF(Switch; Average(array A, array B); array A) | Excel Worksheet Functions | |||
customise array formula output | Excel Discussion (Misc queries) | |||
Getting output from an excel output back to cscript.. | Excel Programming |