共用方式為


shuffle_order_engine Class

藉由重新排列從其基底引擎所傳回的值會產生隨機序列。

template<class Engine,
    size_t K>
    class shuffle_order_engine {
public:
    typedef Engine base_type;
    typedef typename base_type::result_type result_type;
    static constexpr size_t table_size = K;
    shuffle_order_engine();
    explicit shuffle_order_engine(const base_type& eng);
    explicit shuffle_order_engine(result_type x0);
    explicit shuffle_order_engine(seed_seq& seq);
    void seed();
    void seed(result_type x0);
    void seed(seed_seq& seq);
    const base_type& base() const;
    static constexpr result_type min();
    static constexpr result_type max();
    result_type operator()();
    void discard(unsigned long long count);
private:
    Engine stored_eng;
    result_type stored_arr[K];
    result_type stored_y;
    };

參數

  • Engine
    儲存的引擎型別。

  • K
    K 引擎的參數。

備註

藉由重新排列其基底引擎所傳回的值會產生值的這個範本類別描述 重新啟動電腦。 。 每個建構函式會以基本引擎所傳回的 K 值填入陣列 stored_arr 。 它在其他值並將由引擎所傳回的 stored_y 變數中。 將產生的序列的每個項目與 stored_y然後取得,之後,:

  • 陣列索引 J 計算成 K * (stored_y - min()) / (max() - min() + 1)。

  • stored_y 會 stored_arr[J]取代。

  • stored_arr[j] 會 stored_eng()取代。

引擎的狀態為 stored_eng狀態,後面接著 stored_arr的 K 項目,接著 stored_y。

樣板引數 K 的值必須大於零。

需求

標題: <random>

命名空間: std

請參閱

參考

<random>

shuffle_order_engine::base

shuffle_order_engine::base_type

shuffle_order_engine::discard

shuffle_order_engine::operator()

shuffle_order_engine::seed

shuffle_order_engine::shuffle_order_engine