首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::linear_congruential_engine

Defined in header <random>

template< class UIntType, UIntType a, UIntType c, UIntType m > class linear_congruential_engine;

(since C++11)

linear_congruential_engine是一个基于线性同余发生器%28 LCG%29一个LCG有一个由一个整数组成的状态。

LCG函数的转移算法是x。

I+1。←%28AX

I+c%29 mod m.

以下类型定义了具有两个常用参数集的随机数引擎:

在标头中定义<random>

*。

类型定义

明斯特[医]RANDO STD::线性[医]同余[医]引擎<std::uint[医]扣件32[医]T,16807,16807,2147483647>于1969被路易斯、古德曼和米勒发现,1988被朴槿惠和米勒作为“最低标准”。

明斯特[医]兰德性病::线性[医]同余[医]引擎<std::uint[医]扣件32[医]T,48271,0,2147483647>更新的“最低标准”,由Park,Miller和Stockmeyer在1993推荐。

成员类型

Member type

Definition

result_type

The integral type generated by the engine. Results are undefined if this is not an unsigned integral type.

成员函数

建设与播种

*。

%28构造函数%29构造引擎%28公共成员函数%29

种子设置引擎%28公共成员函数%29的当前状态。

世代

运算符%28%29提升引擎%27s状态并返回生成值%28公共成员函数%29

丢弃将引擎%27s状态提升指定数量%28公共成员函数%29

特征

敏静态获取输出范围%28公共静态成员函数%29中的最小可能值。

马克斯静态获取输出范围%28公共静态成员函数%29中的最大可能值。

非会员职能

operator==operator!=

compares the internal states of two pseudo-random number engines (function template)

operator<<operator>>

performs stream input and output on pseudo-random number engine (function template)

成员对象

constexpr UIntType multiplier static

the multiplier term (a). (public static member constant)

constexpr UIntType increment static

the increment term (c). (public static member constant)

constexpr UIntType modulus static

the modulus term (m). (public static member constant)

constexpr UIntType default_seed static

the default seed (1). (public static member constant)

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券