如何是一个随机数在运行时产生的? [英] How is a random number generated at runtime?

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

问题描述

由于电脑不能选择随机数(可以是吗?)这是怎么随机数实际产生。例如,在C#中,我们说,

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

Random.Next()

里面会发生什么?

What happens inside?

推荐答案

您可以结帐这篇文章。按照文档是基于唐纳德·E克努特在.NET中使用的具体实施消减随机数生成算法。欲了解更多信息,请参见 D. E.克努特。 计算机程序设计,第2卷的艺术:半数值算法。艾迪生韦斯利,阅读,MA,第二版,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天全站免登陆