lundi 24 septembre 2018

C++: Get state of linear congruential generator

It seems that if I write

#include <random>
std::minstd_rand engine(1);

std::cout << engine;

then this prints out the internal state of the engine (which is a linear congruential generator). Right now the state equals the seed (1), but if I call a random number and print out engine, it returns some large number, which is probably the state.

How do I actually get the state, in a variable?




Aucun commentaire:

Enregistrer un commentaire