通过丢弃其基本引擎返回的值生成一个随机顺序。保留为TR1兼容性。请改用 discard_block_engine Class。
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