lundi 4 avril 2016

How to detect that the entire period of C++ random engine has been consumed

I want to write a small (fast) C++ program which essentially measures the time required for consuming the entire period of a std::minstd_rand0 engine. In other words I don't care about the target distribution (it can be uniform), but I want to detect that the sequence of pseudo-random variates is repeating.

Any ideas on how I should proceed? One option I was considering is to create two std::array variables. In the first std::array I would store say the 10000 first pseudo-random variates returned by std:minstd_rand0. I would then proceed by filling the other std::array with successive blocks of 10000 variates and compare the contents of the 2 arrays after each pass of 10000 variates. I would consider that the entire period has been consummed once the 2 arrays are equals.

Would this approach be sensible?




Aucun commentaire:

Enregistrer un commentaire