名稱空間
變體
操作

std::discard_block_engine

來自 cppreference.com
< cpp‎ | 數值‎ | 隨機
 
 
 
 
 
定義於標頭檔案 <random>
template<

    class Engine,
    std::size_t P, std::size_t R

> class discard_block_engine;
(C++11 起)

discard_block_engine 是一個偽隨機數引擎介面卡,它丟棄由基本引擎生成的一定數量的資料。對於基本引擎生成的每個大小為 P 的塊,該介面卡只保留 R 個數字,丟棄其餘的。

目錄

[編輯] 模板引數

Engine - 所包裝引擎的型別。
P - 塊的大小。期望 P > 0
R - 每個塊中使用的數字數量。期望 0 < R ≤ P
型別要求
-
Engine 必須滿足 RandomNumberEngine 的要求。

[編輯] 成員型別

成員型別 定義
result_type (C++11) Engine::result_type

[編輯] 成員函式

構造引擎介面卡
(public 成員函式) [編輯]
(C++11)
設定底層引擎的狀態
(public 成員函式) [編輯]
(C++11)
返回底層引擎
(public 成員函式) [編輯]
生成
推進底層引擎的狀態並返回生成的值
(public 成員函式) [編輯]
(C++11)
按指定量推進介面卡的狀態
(public 成員函式) [編輯]
特性
[靜態] (C++11)
獲取底層引擎輸出範圍內的最小可能值。
(public static 成員函式) [編輯]
[靜態] (C++11)
獲取底層引擎輸出範圍內的最大可能值。
(public static 成員函式) [編輯]

[編輯] 非成員函式

(C++11起)(C++11起)(C++20中移除)
比較介面卡和底層引擎的內部狀態
(函式) [編輯]
對偽隨機數引擎介面卡執行流輸入和輸出
(函式) [編輯]

[編輯] 成員常量

constexpr size_t block_size
[靜態] (C++11)
塊的大小,P
(public static 成員常量)
constexpr size_t used_block
[靜態] (C++11)
每個塊中使用的數字數量,R
(public static 成員常量)

[編輯] 示例