std::linear_congruential_engine
来自cppreference.com
![]() |
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <random> 中定义
|
||
template< class UIntType, |
(C++11 起) | |
一个linear_congruential_engine无符号整数的随机数。 LCG状态的大小为1,由一个整数.
原文:
A linear_congruential_engine produces unsigned integer pseudorandom numbers. The state of a LCG is of size 1 and consists of a single integer.
的过渡算法的LCG函数是x
i+1 ← (ax
i+c) mod m.
i+1 ← (ax
i+c) mod m.
原文:
The transition algorithm of the LCG function is x
i+1 ← (ax
i+c) mod m.
i+1 ← (ax
i+c) mod m.
目录 |
[编辑] 会员类型
会员类型
|
Definition |
result_type
|
由发动机产生的积分型。结果是不确定的,如果这不是一个无符号整数类型.
原文: The integral type generated by the engine. Results are undefined if this is not an unsigned integral type. |
[编辑] 成员函数
| |
构造的发动机 (公共成员函数) | |
设置当前状态的发动机 原文: sets the current state of the engine (公共成员函数) | |
| |
推进发动机的状态,并返回生成的值 原文: advances the engine's state and returns the generated value (公共成员函数) | |
推进发动机的状态按指定的量 原文: advances the engine's state by a specified amount (公共成员函数) | |
| |
[静态的]</div></div>
|
得到的输出范围中的最小可能值 原文: gets the smallest possible value in the output range (公共静态成员函数) |
[静态的]</div></div>
|
gets the largest possible value in the output range (公共静态成员函数) |
[编辑] 非成员函数
比较两个伪随机数引擎的内部状态的 原文: compares the internal states of two pseudo-random number engines (函数) | |
执行流的输入和输出的伪随机数的发动机 原文: performs stream input and output on pseudo-random number engine (函数) |
[编辑] 会员对象
constexpr UIntType multiplier [静态的]</div></div>
|
乘法器术语(一). (公共静态成员常量) |
constexpr UIntType increment [静态的]</div></div>
|
增量术语(三). (公共静态成员常量) |
constexpr UIntType modulus [静态的]</div></div>
|
模数项(m). (公共静态成员常量) |
constexpr UIntType default_seed [静态的]</div></div>
|
“的默认种子(1). (公共静态成员常量) |