hello,
I'm trying to use Excel VBA to create a function sub for a triangular distribution with parameters a(min), b(mode), and c(max).
The method is:
- Calculate d = (b-a)/(c-a)
- Generate a uniformly distributed random number U between 0 and 1 (with the rnd function)
- If U<d return a+(c-a)*sqr(dU) as the random number
- Else, return a+(c-a)*[1-sqr((1-d)*(1-U))] as the random number.
Currently I have:
But it doesn't seem to run on the excel spreadsheet.![]()
Please Login or Register to view this content.
Any help is greatly appreciated
Thanks
Bookmarks