我如何用编程语言(例如 Java)实现以下概率
假设有 10 个站在给定时间发送数据包,
我们假设时间是从计数器获得的,因此,例如,
我们可以让
counter = 1,2,3,...
如果 counter=1 那么此时例如,我们可以有 5 个站发送数据包, 在另一时间,计数器= 2,我们可以有2等等
我假设传输时间
现在为零,我们知道在给定时间发送数据包的站数量遵循泊松分布
我有两个与此相关的问题:
- < p>我如何使用 Java 来模拟这种概率? 在 for 循环中,我可以计算时间,然后当时间改变时,我可以找出有多少个站正在发送数据包,并且这个数量将遵循泊松分布 我还没有找到任何可以执行以下操作的特定函数,例如类或其他任何内容,我是否必须为此目的创建自己的代码?
通过知道发送数据包的站点数量遵循泊松分布,是否有可能以某种方式从每个站点(1 到 10)生成随机数据包,以便最终生成的数据包数量,将遵循泊松分布?
提前致谢
Suppose that you have 10 stations that are sending packets at a given time
let's assume that the time is obtained from a counter, so for example
we can have
counter = 1,2,3,...
if counter=1 then at this time we can have for example 5 stations sending packets,
at another time, counter = 2 we can have 2 etc
I assume that the transmission time is zero
now, we know that the amount of stations that are sending packets at a given time follows the poisson distribution
I have 2 questions related to this:
How would I use Java in order to somehow simulate this probability?
In a for loop I can just count through the time, and then when the time changes, I can find out how many stations are sending packets, and this amount will be following the poisson distribution
I haven't found any specific function that can do the following, for example class or anything else, would I have to create my own code for this purpose?By knowing that the amount of stations that are sending packets is following the poisson distribution, is it possible to somehow generate random packets from every station(1 to 10) so that the amount of packets that will be generated in the end, will be following the poisson distribution?
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1)您必须编写代码来模拟这种情况。 AFAIK 标准库中没有任何东西可以做到这一点。
2)如果您描述的情况在数学上是准确的,那么您应该能够在代码中对其进行建模。
如果您没有任何编程经验,那么您可能会遇到困难。如果您以前编写过程序,但不是用 Java 编写的,那么情况可能还不错。您必须编写适当的泊松函数,但您可以使用 Java 中的随机数生成工具来帮助您休息。
另外,如果节点在时间 t 发送值的概率 (p) 对于 n 个节点是固定的,那么这不是遵循二项式分布吗?
1) You would have to write code to simulate that situation. AFAIK there is nothing in the standard libraries that would do this.
2) If the situation you describe is mathematically accurate, then you should be able to model that in your code.
If you don't have any experience programming, then you might have a difficult time with this. If you've programmed before, but not in Java, then it might not be too bad. You'd have to write an appropriate poisson function, but you could use the random number generation facilities in Java to help you out with rest.
Also, if the probability (p) that a node would be sending a value at time t is fixed for n nodes, then wouldn't this follow the binomial distribution?