c++ - 为什么 mersenne_twister_engine 保证某些结果?

我在 cppreference's article for std::mersenne_twister_engine 上注意到以下内容(例如 std::mt19937):

The 10000th consecutive invocation of a default-constructed std::mt19937 is required to produce the value 4123659995.

The 10000th consecutive invocation of a default-constructed std::mt19937_64 is required to produce the value 9981545732273789042.

假设对标准的这种解释是准确的,那有什么关系呢?为什么存在这些保证?这不是非随机吗?

最佳答案

从提案中,N1398 :

How can a user have confidence that the implementation of a random-number engine is exactly as specified, correctly taking into account any platform pecularities [sic] (e.g., odd-sized ints)? After all, minor typos in the implementation might not be apparent; the numbers produced may look "random". This proposal therefore specifies for each engine the 10000th number in the random number sequence that a default-constructed engine object produces.

因此,它只是一个相对任意的“路径点”,被选择为确保实现符合此 PRNG 语义的一种方式。

它本身不是语义约束;这是实现是否符合要求的验证

IMO 可能需要在标准文本中添加注释,因为这是一种前所未有的双重检查实现质量的方法。 (我不知道有任何其他功能的实现 QoI 可以通过标准文本本身给出的样本数据来验证。)

功劳归于Blastfurnace对于first arriving at this notion .

https://stackoverflow.com/questions/54876332/

相关文章:

jquery - 我试图让这个光标效果对 react

django - 从 Django 模型中的选择中获取人类可读名称的实际值

haskell - 了解如何应用 haskell 应用仿函数

r - 无法安装 tidyverse

spring-boot - 如何将base64转换为java中的MultipartFile

arrays - Julia - 许多分配以浏览结构中的数组

r - 你能在 RMarkdown 中左对齐或加粗 Kable 的表格/图形标题吗?

r - 从分布到置信区间的寓言

ag-grid - 如何从 Ag-Grid 上下文菜单中隐藏 'Export' 并替换为 'Tool

python - 无法安装 Python secret 包