Random Number Generator - MDN Web Docs Glossary: Definitions of Web-related terms 编辑
A PRNG (pseudorandom number generator) is an algorithm that outputs numbers in a complex, seemingly unpredictable pattern. Truly random numbers (say, from a radioactive source) are utterly unpredictable, whereas all algorithms are predictable, and a PRNG returns the same numbers when passed the same starting parameters or seed.
PRNGs can be used for a variety of applications, such as games.
A cryptographically secure PRNG is a PRNG with certain extra properties making it suitable for use in cryptography. These include:
- that it's computationally unfeasible for an attacker (without knowledge of the seed) to predict its output
- that if an attacker can work out its current state, this should not enable the attacker to work out previously emitted numbers.
Most PRNGs are not cryptographically secure.
Learn more
General knowledge
- Pseudorandom number generator on Wikipedia
Math.random()
, a built-in JavaScript PRNG function. Note that this is not a cryptographically secure PRNG.Crypto.getRandomValues()
: this is intended to provide cryptographically secure numbers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论