运行时如何生成随机数? [英] How is a random number generated at runtime?

查看:23
本文介绍了运行时如何生成随机数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于计算机无法选择随机数(他们可以吗?)这个随机数是如何实际生成的.例如在 C# 中,我们说,

Since computers cannot pick random numbers(can they?) how is this random number actually generated. For example in C# we say,

Random.Next()

里面发生了什么?

推荐答案

您可以查看这篇文章.根据文档,.NET 中使用的具体实现是基于关于 Donald E. Knuth 的减法随机数生成器算法.有关详细信息,请参阅 D.E. 克努斯.计算机编程艺术,第 2 卷:半数值算法".Addison-Wesley,雷丁,马萨诸塞州,第二版,1981 年.

You may checkout this article. According to the documentation the specific implementation used in .NET is based on Donald E. Knuth's subtractive random number generator algorithm. For more information, see D. E. Knuth. "The Art of Computer Programming, volume 2: Seminumerical Algorithms". Addison-Wesley, Reading, MA, second edition, 1981.

这篇关于运行时如何生成随机数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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