本文介绍了生成均值和方差已知的随机数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从我正在阅读的一篇论文中可以知道:
From a paper I'm reading right know:
...
S(t+1, k) = S(t, k) + ... + C*∆
...
∆ is a standard random variable with mean 0 and variance 1.
...
如何生成具有此均值和方差的一系列随机值?如果有人链接到C或C ++库,我会很高兴,但是如果有人告诉我怎么做,我也不介意自己实现它:)
How to generate this series of random values with this mean and variance? If someone has links to a C or C++ library I would be glad but I wouldn't mind implementing it myself if someone tells me how to do it :)
推荐答案
您对\Delta
的发行有任何限制吗?如果不是,您可以在[-sqrt(3), sqrt(3)]
中使用统一分布.之所以可行,是因为对于均匀分布[a,b]
,方差为1/(12) (b-a)^2
.
Do you have any restrictions on the distribution of \Delta
? if not you can just use a uniform distribution in [-sqrt(3), sqrt(3)]
. The reason why this would work is because for an uniform distribution [a,b]
the variance is 1/(12) (b-a)^2
.
这篇关于生成均值和方差已知的随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!