关于生日悖论结果的一些问题

发布于 2025-02-11 16:33:45 字数 395 浏览 1 评论 0原文

我需要有人纠正我或与我讨论,为什么我的23人计算生日悖论的结果总是〜65%。据说应该是约50%,但是无论我做什么,我都会收到这个结果。

我要求的是有人向我解释我做错了什么并纠正了我,或者向我解释(如果我很好)为什么我的结果是我的结果。

我制作的小程序在这里: dotnetfiddle

可以看到它并指出他们的想法?

谢谢!希望大家过得愉快。

编辑:感谢您的反馈!问题是,当发现dupe时,我只清除了列表,并通过将“透明”线移到IF条件外时解决了问题,因此在每次迭代之后都可以运行。 现在结果是恒定的,约为50%。 干杯!

I need someone to correct me or to discuss with me, why are my results of a 23 person calculation of the bday paradox always ~65%. It is said it should be ~50%, but whatever I do, I receive this result.

What I ask is someone to explain to me what I did wrong and correct me, or explain to me (if I'm good) why are my results as they are.

The little program I made is here: dotnetfiddle

Could some see it and point out what they think?

Thanks! Hope you all have a great day.

EDIT: Thanks for the feedback! Issue was that I only cleared the list when the dupe was found and was resolved by moving the "clear" line outside of the if condition so it runs after every iteration.
Now the results are constant, and around 50%.
Cheers!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白衬杉格子梦 2025-02-18 16:33:46

因为您仅在发现DUPE的情况下清除列表。对于非DUPE情况,在下一个迭代中,列表不断提高DUPE的可能性。

Because you clear up the list only in cases when dupes are found. For non-dupe cases the list keeps growing increasing probability of the dupes in the next iterations.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文