在正态分布后生成N个点

时间:2016-12-07 22:39:02

标签: random fortran normal-distribution probability-density

有没有人知道在Fortran 90中如何能够在正态分布后产生N个随机数,平均μ和标准差sigma? 甚至是产生N值的逻辑过程?

2 个答案:

答案 0 :(得分:0)

(不是fortran程序员)

标准/您的编译器为(0,1)中的统一随机值定义了一些随机函数。 (例如:Gnu Fortran Docs

现在,只需选择一种为高斯采样设计的众所周知的专业采样算法at wikipedia

最知名的:

答案 1 :(得分:-2)

PROGRAM XX
IMPLICIT NONE
REAL                 :: Std_Dev   = .1
REAL                 :: Variance 
INTEGER              :: N         = 100
REAL, DIMENSION(100) :: RData
REAL< PARAMETER      :: Steigler  = /(1.0/6.28)/

Variance = Std_Dev**2      !variance from the std deviation maybe with some steigler or 2.88 distribution
CALL RANDOM_NUMBER(RData)  !distributed as 0-1

RData = RData * Variance   !RData is now with variance
RData = RData + Mean       !RData is now with variance and mean

WRITE(*,*)'Data=',RData

!... Insert your statistics code here to debug it...

END PROGRAM