您的伪随机数生成器 (PRNG) 是否不够随机?

发布于 2024-10-18 10:55:53 字数 192 浏览 10 评论 0原文

您是否曾经编写过模拟或随机算法,但由于所使用的(伪)随机数的质量而遇到麻烦?

发生了什么事?

您是如何检测/意识到您的 prng 是问题所在的?

切换 PRNG 是否足以解决问题,还是必须切换到真正的随机源?

我试图弄清楚哪些类型的应用程序需要人们担心其随机性来源的质量,以及当这成为问题时人们如何意识到。

Have you ever written simulations or randomized algorithms where you've run into trouble because of the quality of the (pseudo)-random numbers you used?

What was happening?

How did you detect / realize your prng was the problem?

Was switching PRNGs enough to fix the problem, or did you have to switch to a source of true randomness?

I'm trying to figure out what types of applications require one to worry about the quality of their source of randomness and how one realizes when this becomes a problem.

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

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

发布评论

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

评论(2

我偏爱纯白色 2024-10-25 10:55:53
  1. 过时的随机数生成器 RANDU 在七十年代因生成“坏”随机数而臭名昭著。我的博士导师提到这影响了他的博士学位,他必须重新运行模拟。在 Google 上搜索 RANDU 线性同余发生器 提出了其他例子。
  2. 当我在多台机器上运行模拟时,有时我很想生成“随机种子”,而不是仅仅使用适当的并行随机数生成器。例如,使用当前时间(以秒为单位)生成种子。这给我带来了足够多的问题,我不惜一切代价避免这种情况。

这主要是由于我的特殊兴趣,但除了并行计算之外,我永远不会想到创建自己的随机数生成器。在大多数语言中,调用经过良好测试的随机数函数都很简单。

  1. The dated random number generator RANDU was infamous in the seventies for producing "bad" random numbers. My PhD supervisor mentioned that it affected his PhD and he had to rerun simulations. A search on Google for RANDU linear congrunetial generator brings up other examples.
  2. When I run simulations on multiple machines, I've sometimes been tempted to generate "random seeds", rather than just use a proper parallel random number generator. For example, generate the seed using the current time in seconds. This has caused me enough problems that I avoid this at all costs.

This is mainly due to my particular interests, but other than parallel computing, the thought of creating my own random number generator would never cross my mind. Calling a well tested random number function is trivial in most languages.

初心 2024-10-25 10:55:53

针对 DieHard 运行 prng 是一个很好的做法。现在存在非常好的和快速的 PRNG(参见 Marsaglia 的工作),请参见 Numerical Recipes edition 3 以获得很好的介绍。

It is a good practice to run your prng against DieHard. Very good and fast PRNG exist nowadays (see the work of Marsaglia), see Numerical Recipes edition 3 for a good introduction.

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