Excel VBA中广义pareto分布和Weilbull分布的随机数发生器

Excel VBA中广义pareto分布和Weilbull分布的随机数发生器,excel,random,distribution,weibull,vba,Excel,Random,Distribution,Weibull,Vba,我想在VBA中用威布尔分布和广义帕累托分布生成随机数。你能帮我一下吗。我对使用分析工具包VBA不感兴趣 提前感谢,, Skeihani这些用户定义的函数可以执行您想要的操作: Function RandWeib(fScale As Single, _ fShape As Single, _ Optional bVolatile As Boolean = False) As Single ' shg 2008 ' h

我想在VBA中用威布尔分布和广义帕累托分布生成随机数。你能帮我一下吗。我对使用分析工具包VBA不感兴趣

提前感谢,,
Skeihani

这些用户定义的函数可以执行您想要的操作:

Function RandWeib(fScale As Single, _
                  fShape As Single, _
                  Optional bVolatile As Boolean = False) As Single

  ' shg 2008
  ' http://en.wikipedia.org/wiki/Weibull_distribution

  ' Returns a random variate with Weibull distribution
  ' fScale > 0
  ' fShape > 0
  ' By formula: =Scale * -LN(RAND()) ^ (1 / Shape)

  If bVolatile Then Application.Volatile

  RandWeib = fScale * (-Log(1! - Rnd())) ^ (1! / fShape)
End Function

Function RandPareto(fScale As Single, _
                    fShape As Single, _
                    Optional bVolatile As Boolean = False) As Single
  ' shg 2015
  ' https://en.wikipedia.org/wiki/Pareto_distribution

  ' Returns a random variate with Pareto distribution
  ' fScale > 0
  ' fShape > 0
  ' By formula: =Scale / RAND() ^ (1 / Shape)

  If bVolatile Then Application.Volatile

  RandPareto = fScale / (1! - Rnd()) ^ (1! / fShape)
End Function

谢谢你,shg,你也有威布尔分布的资料吗。哦,对不起,刚才注意到威布尔分布有RandWeib,谢谢