问题
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