随机选择对象的算法
我想实现一个模拟:有1000个对象;在 1800 秒的时间内,随机选择每个对象(或任何动作);所选对象的数量随时间大致分布:60秒内选择30%,60秒后但300秒内选择40%,300秒后但600秒内选择20%,10%将在 600 秒后被选择。
那么每秒每个对象被选择的概率是多少?
I want to implement a simulation: there are 1000 objects; during a period of time 1800 seconds, each object is randomly selected (or whatever action); the number of selected objects along time follows a rough distribution: 30% will be selected within 60 seconds, 40% will be selected after 60 seconds but within 300 seconds, 20% will be selected after 300 seconds but within 600 seconds, and 10% will be selected after 600 seconds.
So what is the probability for each object being selected every second?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能更适合 StackExchange 的程序员部分: Programmers Exchange
但只需快速滑动一下,您就可以在其中选择 300 个对象前 60 秒,接下来 240 秒 400 个对象,接下来 300 秒 200 个对象,最后 1200 秒 100 个对象。这可以让您了解模拟的每一秒中每秒有多少个对象。
例如,您在前 60 秒内每秒选择 5 个对象,因此在前 60 秒内每秒选择任何特定对象的概率为 5/1000 或 0.5%。
我认为如果我正确理解你的问题,这应该会引导你找到答案。
This might be more appropriate to the Programmers section of StackExchange here: Programmers Exchange
But just taking a quick swipe at this, you select 300 objects in the first 60 seconds, 400 objects in the next 240 seconds, 200 objects in the next 300 seconds, and 100 objects in the last 1200 seconds. That gives you a sense of objects per second for each second of your simulation.
So, for example, you select 5 objects per second for the first 60 seconds, so there is a 5/1000 or 0.5% probability of selecting any specific object in each second of those first 60 seconds.
I think that should lead you to the answer if I understand your question correctly.