从指数分布生成随机数 [英] Generate random numbers from an exponential distribution
本文介绍了从指数分布生成随机数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 R,我想从均值为 50 的指数分布中生成 100 个随机数.我想将这些数字存储在一个向量中.我认为我做对了,但我在互联网上找不到任何东西来验证我的代码.这是我的代码:
Using R, I want to generate 100 random numbers from an exponential distribution with a mean of 50. I want to store these numbers in a vector. I think I did it correctly, but I cannot find anything on the internet to verify my code. Here is my code:
vector <- rexp(100,50)
推荐答案
解决方案:
vector <- rexp(100, 1/50)
(在@SeverinPappadeux 的评论中回答)
(answered in comments by @SeverinPappadeux )
这篇关于从指数分布生成随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文