jeudi 31 octobre 2019

Should I use std::seed_seq to seed std::mt19937?

Is it ok that 624 integers generated by random_device are directly used to seed mt19937? Should I use seed_seq?

class RDSeq {
public:
    template <typename It>
    void generate (It first, It last) const {
        std::random_device rd {};
        std::generate(first, last, std::ref(rd));
    }
};

std::mt19937 random {};
RDSeq seq {};
random.seed(seq);



Aucun commentaire:

Enregistrer un commentaire