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

UniformRandomBitGenerator

统一随机位生成器是返回无符号整数值的函数对象,这样,可能结果范围内的每个值都有%28理想的%29相等的概率。

均匀随机比特生成器不打算用作随机数生成器:它们被用作批量生成的随机比特%28的源,效率%29。任何均匀的随机位发生器都可以插入任何随机数分布为了得到一个随机数%28形式,随机变量%29。

所需

类型G满足UniformRandomBitGenerator如果。

给予。

  • T,命名为G::result_type
  • g,类型值G

下列表达式必须有效并具有指定的效果。

Expression

Return type

Requirements

G::result_type

T

T is an unsigned integer type

G::min()

T

Returns the smallest value that G's operator() may return. The value is strictly less than G::max().

G::max()

T

Returns the largest value that G's operator() may return. The value is strictly greater than G::min()

g()

T

Returns a value in the closed interval G::min(), G::max(). Has amortized constant complexity.

注记

RandomNumberEngine满足这个概念。

标准库

以下标准库设施期望UniformRandomBitGenerator类型。

random_shuffleshuffle (until C++17)(C++11)

randomly re-orders elements in a range (function template)

generate_canonical (C++11)

evenly distributes real values of given precision across [0, 1) (function template)

uniform_int_distribution (C++11)

produces integer values evenly distributed across a range (class template)

uniform_real_distribution (C++11)

produces real values evenly distributed across a range (class template)

所有其他随机数分布

下列标准图书馆设施UniformRandomBitGenerator没有额外的满足感RandomNumberEngine*

random_device

non-deterministic random number generator using hardware entropy source (class)

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

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

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com