如何在间隔中分离随机数,然后获得python间隔的概率?
我必须使用python中的numpy生成2000浮点随机数,然后获得这些数字的整数间隔,并最终计算频率和概率。
有人可以帮我吗?
I have to generate 2000 float random numbers with a normal distribution using numpy in Python, then get the integer intervals of those numbers and finally calculate the frequency and probability.
Can someone please help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
iiuc,我们知道正态分布中(-1,1)之间的概率为68%,如果我们测试,我们会发现这是正确的:
输出:
您可以使用
plt.hist.hist
(您可以根据需要更改bin),然后计算以下类似于下面的频率和概率:IIUC, We know the probability between (-1,1) in a normal distribution is 68% and If we test we see this is correct:
Output:
You can use
plt.hist
(you can change bin as you want) and then compute frequency and probability like below:Output: