更新时间:2023-08-23 13:18:04
std::random_device
应该为您提供诸如mt19937
之类的引擎的种子.产生的连续数字的质量是完全不确定的,对于实际目的(例如密码学)可能很容易不足,因此依靠它是毫无疑问的.
std::random_device
is supposed to get you a seed for engines like mt19937
. The quality of successive numbers produced is completely undefined and may easily be insufficient for practical purposes (such as cryptography), so relying on that is out of question.
除此之外,mt19937
将在给定相同种子的情况下为您提供相同的序列. random_device
s的值只能受到为其构造函数提供的字符串的影响……这意味着实现定义的行为.
Apart from that, mt19937
will give you the same sequence when given the same seed. A random_device
s values can be only influenced by the string given to its constructor... which implies implementation-defined behavior.