登录论坛

查看完整版本 : 如何生成在此范围内的随机数? [重复]


poster
2019-12-07, 15:22
这个问题已经在这里有了答案:



用给定的概率生成随机数matlab (https://www.labfans.com/questions/13914066/generate-random-number-with-given-probability-matlab) 5 answers
从Matlab中预先指定的概率质量函数中提取随机数 (https://www.labfans.com/questions/58607156/draw-random-numbers-from-pre-specified-probability-mass-function-in-matlab) 1答案


我想生成一些随机数,用于这种分布:



其中10%位于A类(T = 6),
其中40%位于B类(T = 8),
其中40%位于C类(T = 10),
其中10%位于D类(T = 12)。

我刚开始学习MATLAB,尝试过rand(x)和randn(x)但似乎他们俩都做不到?



更多&回答... (https://stackoverflow.com/q/58723874)