discard_block クラス
ベースとなるエンジンから返された値を破棄することによってランダム シーケンスを生成します。TR1 との互換性のために保持されています。代わりに discard_block_engine クラス を使用してください。
template<class Engine,
int P, int R>
class discard_block {
public:
typedef discard_block<Engine, P, R> _MyT;
typedef Engine base_type;
typedef typename base_type::result_type result_type;
static const int block_size = P;
static const int used_block = R;
discard_block();
discard_block(const discard_block& right);
discard_block(discard_block& right);
explicit discard_block(const base_type& eng);
explicit discard_block(result_type seed);
template<class Gen>
discard_block(Gen& gen);
void seed();
template<class Gen>
void seed(Gen& gen);
const base_type& base() const;
result_type min() const;
result_type max() const;
result_type operator()();
private:
Engine stored_eng; // exposition only
int count; // exposition only
};
パラメーター
Engine
格納されている乱数エンジンの型。P
合計ブロック サイズ。R
使用ブロック サイズ。
解説
このテンプレート クラスは、ベースのエンジンから返された値の一部を破棄することで値を生成する複合エンジンを表します。この複合エンジンは、ベースのエンジンによって連続的に生成された R 個の値を返し、不使用となった P - R 個の値を破棄するというサイクルを繰り返します。エンジンの状態は、stored_eng の状態を初期状態とし、その後は、現在のサイクルの開始以降に operator() が呼び出された回数がエンジンの状態となります。
テンプレートの引数 R の値は、テンプレートの引数 P の値と同じかそれよりも小さくする必要があります。
必要条件
ヘッダー : <random>
名前空間: std