Java正态分布 [英] Java normal distribution

查看:954
本文介绍了Java正态分布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图模拟球迷到达体育场的过程。系统本身,我相信这不会是一个问题,但是,粉丝的到来遵循正常的分布。

I'm trying to simulate the arrival of fans to a stadium. The system itself, I believe it won't be a problem, but, the arrival of the fans follows a normal distribution.

我的问题是:

我有一段时间来到达,如100分钟和1000名粉丝,以及我需要在分发之后一次产生粉丝的到来,比如 - >粉丝x到达25分钟,粉丝到达54分钟,依此类推。

I have a certain time for the arrival like 100 minutes and 1000 fans, and I need to generate arrivals of Fans at a time following that distribution like -> fan x arrived at 25 minutes, fan y arrived at 54 minutes, and so on.

如何我可以在正态分布后生成这些随机数吗?

How can I generate these random numbers following a normal distribution?

我在Java中这样做,发现 nextGaussian() 随机课程中的方法,但我我不确定如何在我的情况下使用它。

I'm doing this in Java and found the nextGaussian() method in the Random class, but I'm not sure how to use this in my situation.

有人可以开导我吗?

推荐答案

nextGaussian()将从正态分布中抽取平均值为0且标准偏差为1的样本,因此如果你想要平均1小时和std-偏差15分钟,您需要将其称为 nextGaussian()* 15 + 60

nextGaussian() will draw samples from a normal distribution with mean 0 and std-deviation 1, so if you want mean 1 hour and std-deviation 15 minutes you'll need to call it as nextGaussian()*15+60.

来自< a href =https://docs.or acle.com/javase/8/docs/api/java/util/Random.html#nextGaussian--rel =noreferrer> 的文档> Random.nextGaussian()


返回:

下一个伪随机,高斯(正常)分布式双值此随机数生成器序列的平均值为0.0和标准差1.0

Returns:
the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence

这篇关于Java正态分布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆