pseudorandom number generation from truncated normal distribution in FORTRAN [closed]

旧街凉风 提交于 2019-12-27 01:45:21

问题


I am trying to draw pseudo random numbers from a left-truncated normal distribution using FORTRAN. I want the function to return values with the same dimension as inputs:

FUNCTION (MU, SIGMA) ; mu=N x 1 and SIGMA = N X 1

Can someone help please? Thanks in advance


回答1:


Perhaps use the GNU Scientific Library and the Fortran interface thereto: http://www.lrz.de/services/software/mathematik/gsl/fortran/. The GSL has a random normal generator. Reject and try again if the number is on the wrong side. The easiest method is to put it all in a loop and use the underlying random number generator in a serial manner. Multi-threaded random numbers are subtle to get right.



来源:https://stackoverflow.com/questions/21814840/pseudorandom-number-generation-from-truncated-normal-distribution-in-fortran

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!